Jump to content

Memory Leak Detection


gamecreator
 Share

Recommended Posts

Hello. I was just wondering what the community here likes to use for memory leak detection.

 

I ask because last night my program started to crash in a random place that doesn't make any sense and I figured I have a memory leak. I use Windows Visual Studio 2013 so anything that works with that is a bonus.

 

I found a few things like Visual Leak Detector online and a lot of people seem to suggest Valgrind but I thought I'd ask anyway.

 

Thanks!

Link to comment
Share on other sites

Hi,

Valgrind isn't available for windows (which I assume you are using because of visual studio wink.png )

Visual Leak Detector is a nice piece of software. Sadly you can't really debug for memory leaks with Leadwerks 3, since the LUA-VM will always allocate and free memory. So when trying to use VLD or similar stuff with LW3, you will end up with 1000+ Memory Leaks found anywhere inside the LW-Lib.

See http://www.leadwerks.com/werkspace/topic/9505-tons-of-memory-leaks-in-leadwerks/page__hl__leak for details.

Actually I figure the only way of really testing for memory leaks is using

System::GetMemoryUsage()

where you still have to do a lot of analysing sad.png .

Or does anyone have a better idea?

  • Upvote 1
Link to comment
Share on other sites

Yeah, just figured this out the hard way. Finally got Visual Leak Detector working (didn't report while my program crashed so I had to comment out some lines to make it exit normally) and I got 2308 memory leaks, which I doubt are all mine. So I have a billion lines of debug information which I can't make heads or tails of.

 

What kills me is that this project is pretty simple right now. The problem may well be obvious to some people and very simply wrong once found... but it all looks fine to me right now.

 

I'll try some other suggestions and test my luck. Otherwise I don't know what to do.

Link to comment
Share on other sites

You should go C++ to make a complete game with LE3, and keep Lua for simple stuff only like some level logic as door , interactive stuff; and you'll have all language advantages and benefits.

But i agree some 2308 memory leaks is really big, perhaps osme problem on your configuration or project ?

How is behaving memory when you play the game ? pretty stable ? Caus even with memory leaks, the garbage collector perhaps do well it's job ?

Stop toying and make games

Link to comment
Share on other sites

You should go C++ to make a complete game with LE3, and keep Lua for simple stufrf only like some level logic as door , interactive stuff. C++ is the way to go in LE3 specially if you target better performance and have all language advantages and benefits.

 

Well, Visual Leak Detector is a tool for C++ and memory leaks are C++-only (no problem for LUA) wink.png .

The problem is, that even in a new LW-C++ project (even if you don't use any LUA-scripts), the LUA-Virtual Machine is started and claims and releases memory. I don't think, there is a way to disable this.

Link to comment
Share on other sites

what always gets me in c++ is accidentally going outside of array bounds, or providing null references (took me a while to figure out what a segfault was).. It'd be awesome if you could disable memory leak detection for certain areas of code like Lua.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...