Jump to content
  • Advertisement
Sign in to follow this  
raptorstrike

How do you get the debugger to look for mem leaks

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

Title pretty much says it all, im working with the compiler that comes with Dev-Cpp and i dont remeber how to get it to search for mem-leaks refrences on the debugger its self and commands would be helpful too thanks =)

Share this post


Link to post
Share on other sites
Advertisement
well, i know there is a way to do this. I could never get it to work and it wasnt fantastically helpful to those who did(if memory serves).

I recomend wrting a memory manager that way you can create the functionality you are looking for and look for only the data you need.

Share this post


Link to post
Share on other sites
devcpp uses gdb for debugging. As far as I know, gdb doesn't have any built-in facility for detecting memory leaks.

As to a debug reference, try here.

Share this post


Link to post
Share on other sites
Paul Nettle's Memory Manager

The memory manager I always suggest to people, it's amazing and works without any trouble in vc++ right off the bat. I've never tried it with GCC though, tell me how it works if you end up trying it. It will detect where any memory leaks are in your applications and tell you the file and line they're on as well as a few other things.

Should that memory manager be in the FAQ? I've seen it referenced a number of times, and I've personally linked to it three times.

Share this post


Link to post
Share on other sites
Nice article/tutorial about memory leaks and how to track them down. Remember having some trouble porting this to GCC, but after all it was a trivial task. With some extra work this could be used to show memory usage in realtime when debugging your app, or simply put the peak of your memory usage in the logfile.

Share this post


Link to post
Share on other sites
im ganna try that memory manager program but im having some problems, all im doing with it right now is including it and i get this error

C:/MinGW/include/c++/3.3.1/new:82: error: syntax error before `m_setOwner'
C:/MinGW/include/c++/3.3.1/new:82: error: initializer list being treated as
compound expression

C:/MinGW/include/c++/3.3.1/new:82: error: cannot convert `bool' to `void*' in


any idea y im getting this when i include the header for the mmgr?

it looks like there was some small error before and thats just throwing the whole thing out of whack but im not sure

it gives this:

82 C:\MinGW\include\c++\3.3.1\new syntax error before `m_setOwner'

here

void* operator new(std::size_t) throw (std::bad_alloc);

which i assume has to do with these lines

#include "nommgr.h"
#define new (m_setOwner (__FILE__,__LINE__,__FUNCTION__),false) ? NULL : new
#define delete (m_setOwner (__FILE__,__LINE__,__FUNCTION__),false) ? m_setOwner("",0,"") : delete
#define malloc(sz) m_allocator (__FILE__,__LINE__,__FUNCTION__,m_alloc_malloc,sz)
#define calloc(sz) m_allocator (__FILE__,__LINE__,__FUNCTION__,m_alloc_calloc,sz)
#define realloc(ptr,sz) m_reallocator(__FILE__,__LINE__,__FUNCTION__,m_alloc_realloc,sz,ptr)
#define free(ptr) m_deallocator(__FILE__,__LINE__,__FUNCTION__,m_alloc_free,ptr)


heck i could be totally wrong but just trying to help



[Edited by - raptorstrike on June 1, 2005 6:17:36 PM]

Share this post


Link to post
Share on other sites
I assume you either have to add the memory manager #include either before all other headers or after all other headers. Only one way is likely to work. Does it say anything about that in the documentation?

Share this post


Link to post
Share on other sites
Paul Nettle MMGR Use this it overloads the operators and checks for memory leaks, tells you total allocated units. Plus for debugging purposes it also has a full output file when memory leaks are detected, along with the function, and line number where it occured. Plus, its on flipcode so you know its good.

Share this post


Link to post
Share on other sites
Another vote for Paul Nettle's memory manager. On my first shootem-up game I wrote a few years back it helped me get from about 1000 memory leaks to 0 :)

If you put it in early and keep checking it's output after every test run of your application you'll be able to catch any leaks pretty easily.

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!