Jump to content
  • Advertisement
Sign in to follow this  
Palidine

malloc returning NULL

This topic is 4272 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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
Advertisement
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
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
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
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
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!