GC works with malloc() works, but throws out of memory with HeapAlloc(). Why?
%u
wfunction at hotmail.com
Mon Jan 3 15:12:53 PST 2011
Hi,
I've recompiled the code for my library to redirect all calls to malloc(),
free(), realloc(), and calloc() to HeapAlloc(), HeapFree(), and HeapReAlloc().
The problem? It doesn't work -- it throws OutOfMemory when the program is
starting (in the mallocNoSync() function) even though those functions do not
fail (I've checked the return values of the functions, and they don't fail;
I've also told them to throw exceptions on failure, and none is thrown).
The funny thing is, if I redirect DMD's malloc() to the msvcrt.dll malloc(),
it works perfectly fine, so it's not like it's a library issue. And it doesn't
seem to be an alignment issue either. Does anyone have any idea what might
cause this? (And I've redirected *all* calls, including the ones from
monitor.c and such, so it isn't a problem with one allocator freeing another
allocator's memory.)
What could possibly be the issue? Any ideas?
Thank you!
More information about the Digitalmars-d
mailing list