Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

CoolTomK

Memory Allocation Problem!!

This topic is 5921 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

Allright...this problem is driving me crazy! I''m using Paul Nettle''s memory manager to check for leaks, but it''s giving me a hard time. There are three pointers to memory I just cant deallocate. Whenever I try to delete[] these pointers to arrays, I hit an assert error saying "If you hit this assert, you tried to deallocate RAM that wasn''t allocated by this memory manager.". The allocation code(using new[]) for these pointers is in the same file as the deallocation code(using delete[]), which includes the "mmgr.h" file, so I''m pretty sure that the memory manager allocated the memory. Does anybody familiar with this memory manager know how I can fix this?

Share this post


Link to post
Share on other sites
Advertisement
Nevermind...figured it out- I was using ZeroMemory to clear out the arrays, I guess ZeroMemory() was reallocating my memory without the memory manager.

Share this post


Link to post
Share on other sites
ZeroMemory doesn't reallocate anything, it just calls memset to change the values of the bytes at the address you give it.

It might be that you're zeroing out the magic number that the memory manager might use to determine whether it allocated the memory or not. In which case, you're still trashing memory you shouldn't really be touching.

[ MSVC Fixes | STL | SDL | Game AI | Sockets | C++ Faq Lite | Boost | Asking Questions | Organising code files ]

[edited by - Kylotan on May 5, 2002 10:04:07 PM]

Share this post


Link to post
Share on other sites

  • 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!