Memory Allocation Problem!!
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?
Nevermind...figured it out- I was using ZeroMemory to clear out the arrays, I guess ZeroMemory() was reallocating my memory without the memory manager.
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]
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]
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement