Memory monitoring and "Application Request Runtime to Terminate"

Started by
1 comment, last by wil_ 14 years, 5 months ago
Hello, Using VMmap I noticed a 10Mb memory leak each time a new play starts in my small 3d game. (BTW I use openGL so maybe it's some resource I didn't correctly release? Then how to make sure?) To locate memory leaks at source level I tried to overload new/delete([]) operators. Everything is fine except that during runtime, there is one object that causes this error message when I try to delete it : "This application has requested the Runtime to terminate it in an unusual way. Please contact the application's support team for more information." This object contains basically standard type variables and std containers (one containing floats, one containing pointers to objects that are allocated/deallocated somewhere else). After a few research it seems I could try to overload placement new that is used by std, but I still had the same crash. When I don't use overloaded operators everything seems fine. Do you see what is the reason of that problem and what should I do to be able to monitor more precisely my memory usage ? Thanks a lot for any help !
Advertisement
You'll need to post some code I imagine for most of us to get a handle on what you are REALLY doing.

---

If you have access to linux I would suggest looking into using the memcheck tool from the valgrind suite. It will find your leak (if there is one) a lot faster than you will more often than not.

I you using windows then a good profiler may be an option. If you have an AMD CPU I think AMD offers their CodeAnalyst for free.

---

If you don't want to use a profiler you don't necessarily need to overload new or delete to find your leak. Depending on your IDE you could search out every new and delete in your program and ensure that they always come in pairs.

Alternatively you could try to use a prexisting allocator which already supplies debugging information. I can't remember for certain but I think Intel's tbb_allocator can print out some debugging info for you. You could also try the nedmallaoc allocator as I think it can print out debugging information as well. Tbb for STL allocators and nedmalloc to replace malloc/free. (been a while since I played with these allocators so definety research before using them)

Or you can overload new and delete globally yourself. I would do it globally if I didn't have a clue where a leak might be happening.

You probably don't need to fiddle with placement new (unless you use it - which is a rare occurrence). It just constructs something in memory you've allocated yourself - but you would know if you've done that and it doesn't seem like you have.

Hope this helps.

[Edited by - Simulacrum on November 9, 2009 8:26:45 PM]
The difference between a dream and reality is only what you choose to do about either of them.
Thanks for your help. I cannot reproduce the crash in an other project, and my code is too long to post here so I will try to rewrite it to find what's wrong.
I'm on a PC but not with AMD so I cannot use the tools you mentioned, but I guess I can find something similar.

This topic is closed to new replies.

Advertisement