Jump to content
  • Advertisement

Archived

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

Zoot

Strange memory...

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

HEAP[Demo.exe]: HEAP: Free Heap block 4c66250 modified at 4c66310 after it was freed Anyone know what it means? I only get this message when i load big maps in my engine.. it works perfectly with small maps.. I am useing new and delete...

Share this post


Link to post
Share on other sites
Advertisement
Sounds like you are reading/writing through a pointer that has been free''d or delete''d.
Try setting your pointers to 0 / NULL after deletion, you''ll get a runtime access violation as soon as you try using the freed pointer.

Share this post


Link to post
Share on other sites
Maybe the problem doesn''t manifest itself with small maps... bugs can be weird and once they occur and the program goes into an undefined state, anything can happen! I would definitely recommend the nulling of the pointers after the delete, that should cause the program to die at the point where the freed pointer is dereferenced, if you run through the debugger you should be able to see the exact line that it happens on.

The only other thing I can think of is that you could be using a 16-bit compiler and you are trying to allocate more than 64K at once.

... thought of a few more possibles...

Have you checked that the allocations actually succeed? Does new throw an exception or return NULL if it fails?

I would certainly recommend running the code through a debugger and mabe putting breakpoints on every line that you call delete... to check everything is working as you expect.

Share this post


Link to post
Share on other sites
I tested the memory manger but it didn´t work so well with ifstream..

But i plaied some and now i get this error instead:

memory check error at 0x03ECBF10 = 0xF8, should be 0xFD.
memory check error at 0x03ECBF11 = 0xE4, should be 0xFD.
memory check error at 0x03ECBF12 = 0xA8, should be 0xFD.
memory check error at 0x03ECBF13 = 0x03, should be 0xFD.

[edited by - Zoot on August 14, 2002 2:44:52 PM]

Share this post


Link to post
Share on other sites
quote:
Original post by shurcool
do what he said, it only works with small maps because u're lucky or something. use a memory manager like MMGR (http://www.fluidstudios.com/publications.html) to make debugging memory leaks easier. if your program starts crashing often when u use it, that's good, because it detected something bad, read the log files and fix it.

---
shurcool
wwdev



Have any idea of how i can get it to work with ifstream?

This works but gives memory leaks:

ifstream *file = new ifstream(filename, ios::in );
file->close();

Any ideas?

[edited by - Zoot on August 14, 2002 9:53:26 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.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!