Jump to content
  • Advertisement

Archived

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

yanuart

How do you trace a memory leak ??

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

It seems that I''d released all my mem when exiting my app, but it still give me the memory leak warning ?? how how how ?? btw, I''m using VC++

Share this post


Link to post
Share on other sites
Advertisement
crtdbg. Have a look on msdn for the specifics.

Neil

WHATCHA GONNA DO WHEN THE LARGEST ARMS IN THE WORLD RUN WILD ON YOU?!?!

Share this post


Link to post
Share on other sites
you could try overriding the new and delete operators. you could then have a data structure which stores each memory allocation...the line number ( by using the __LINE__ macro) in the program where it was allocated, how much was allocated, what type of allocation it was ( eg. * or [] ). then you can print out a log of all the memory allocation structures. you can then tell which new wasn''t paired with a delete and so you can track memory leaks.if you need further help, i''d be happy to help.

Share this post


Link to post
Share on other sites
or you could skip reinventing the wheel and use ftp://ftp.3dmaileffects.com/pub/FluidStudios/MemoryManagers/Fluid_Studios_Memory_Manager.zip

hth

Share this post


Link to post
Share on other sites
yes it is reinventing the wheel. but it''s a good exercise in learning how a few things regarding how memory allocation works. i think it''s better to write your own things like this, if you just keep copying code off people, how do you learn ? and you only need to do it once...

Also, if you''ve written it, you understand it a lot more than using someone elses and getting confused about certain things

Share this post


Link to post
Share on other sites
the debug leak report gives you allocation number. use _CrtSetBreakAlloc to break on that allocation, and use the call stack to see which object is leaked.

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!