Sign in to follow this  
Palidine

malloc returning NULL

Recommended Posts

Palidine    1315
ack. couple of us have been banging at this all day. puzzle pieces: - malloc is returning NULL when it shouldn't be. - we have 3GB ram - the app is using 766MB of ram. there is _plenty_ left in theory (we haven't even started to swap at this point) - _CrtCheckMemory() is showing no heap corruption - depends indicates, however, that the app is using _both_ MSVCP71.dll and MSVCP71D.dll ideas other than suicide? =) -me

Share this post


Link to post
Share on other sites
Sneftel    1788
Commit suici- oh. Um, find out which of the linked-in .LIBs is including the wrong runtime, and rebuild it with the right one. That might fix it. The other alternative is memory corruption; _CrtCheckMemory() is pretty damn good, but it isn't perfect.

Share this post


Link to post
Share on other sites
BrianL    530
Very likely memory fragmentation.

I've seen 300 meg allocations fail on a machine with lots of memory. The program was using less than 100 megs on a 2 gig machine. Address space was probably fragmented by dlls being loaded at unfortunate offsets.

Share this post


Link to post
Share on other sites
markr    1692
If your application legitimately needs many hundreds of megs of ram, and you're getting the fragmentation problems described above, you may want to rebuild it on a 64bit compiler?

That would definitely solve address space fragmentation issues.

Mark

Share this post


Link to post
Share on other sites
Guest Anonymous Poster   
Guest Anonymous Poster
You can run out of virtual memory space wich isn't the same thing as fysical, 2Gb is the limit of virtual memory for a single process in windows.

Your application doesn't have a large allocation of virtual memory space. Could be memory mapped files for example(?).

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this