|
From: | Edward Rosten |
Subject: | Re: [libcvd-members] Aligned mem crashes ? |
Date: | Sun, 26 Nov 2006 10:59:00 -0700 (MST) |
On Sun, 26 Nov 2006, twd20 wrote:
Georg My solution to this is to not use libcvd's aligned_mem stuff but to provide a malloc() which overwrites the weak symbol in glibc and calls posix_memalign() with an alignment of 16. This means that all new()s or malloc()s will return 16 aligned memory (wasting an average of 4 bytes a go) - but it means that all the aligned stuff just works.
One of the problems with this replacement is that it doesn't work with debugging stuff that overrides malloc. On the other hand, none of that seems to work on my system anyway, so it's not such a bad thing, since one could put _working_ debugging stuff in the new malloc if necessary...
You could also replace some of the internals of aligned_mem with posix_memalign instead of new char. Of course, you don't get the benefit for std::vectors then.
-Ed
[Prev in Thread] | Current Thread | [Next in Thread] |