[Bug libc/206] malloc does not align memory correctly for sse capable systems

bangerth at ices dot utexas dot edu sourceware-bugzilla@sources.redhat.com
Mon Jun 7 14:30:00 GMT 2004


------- Additional Comments From bangerth at ices dot utexas dot edu  2004-06-07 14:30 -------
Subject: Re:  malloc does not align memory correctly for sse
 capable systems


> One idea to fix it is to use special handling aligned() for C++ new.  

Yes, but the C++ maintainers have already said that they don't want to do 
that.

As an additional problem, one can overload operator new in an application 
program, so you force writers of such overloads to reinvent the same 
kludge again each time they write such functions. Think of cases like
  template <typename T> class MyClass {
    void * operator new (const size_t sz) {
      // what to do here? we need to figure out the alignment requirements
      // of T, but there is no standard conforming way to do this
    }
  };

Note also that in C++ you can only overload based on types, not on 
alignment requirements, so figuring out the alignment really has to happen 
inside above operator function.

W.

-------------------------------------------------------------------------
Wolfgang Bangerth              email:            bangerth@ices.utexas.edu
                               www: http://www.ices.utexas.edu/~bangerth/




-- 


http://sources.redhat.com/bugzilla/show_bug.cgi?id=206

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.



More information about the Glibc-bugs mailing list