How to detect memory leaks ?

Discuss the development of new homebrew software, tools and libraries.

Moderators: cheriff, TyRaNiD

Post Reply
anmabagima
Posts: 87
Joined: Thu Oct 01, 2009 8:43 pm

How to detect memory leaks ?

Post by anmabagima »

Hi there,

I've set up my own GU homebrew. I tried to clear all instances I've initiated. However, sometimes the PSP crashes where I guess the root cause may be memory leaks. Is there a possability to detect memory leaks ? I'm using minpsp and eclipse as development environment.

Thanks for any hints...

Regards
m0skit0
Posts: 191
Joined: Tue Jun 02, 2009 8:58 pm

Post by m0skit0 »

Good programming prevents memory leaks.
The Incredible Bill Gates wrote:The obvious mathematical breakthrough would be development of an easy way to factor large prime numbers.
User avatar
Raphael
Posts: 646
Joined: Tue Jan 17, 2006 4:54 pm
Location: Germany
Contact:

Post by Raphael »

Memory leaks do not cause program crashes, unless your program comes to the point where it trys to allocate more memory which then fails and your program not handling that case properly.

If you are really concerned about memory leaks, a debug memory manager will help you detect those. One can be found on my devblog, which is an C-Version of the C++ memory manager by Paul Nettle.

Other than that, we cannot help you with your problem, as we don't have enough information.
<Don't push the river, it flows.>
http://wordpress.fx-world.org - my devblog
http://wiki.fx-world.org - VFPU documentation wiki

Alexander Berl
a_noob
Posts: 97
Joined: Sun Sep 17, 2006 8:33 am
Location: _start: jr 0xDEADBEEF

Post by a_noob »

You can also use mmgr to look for memory leaks if you still believe that is the cause.

Code: Select all

.øOº'ºOø.
'ºOo.oOº'
anmabagima
Posts: 87
Joined: Thu Oct 01, 2009 8:43 pm

Post by anmabagima »

m0skit0 wrote:Good programming prevents memory leaks.
You are absolutely right, but as human's we do make mistakes. And you could even search hours for this one or even get some help of tools, if there are some ;)
anmabagima
Posts: 87
Joined: Thu Oct 01, 2009 8:43 pm

Post by anmabagima »

Raphael wrote:Memory leaks do not cause program crashes, unless your program comes to the point where it trys to allocate more memory which then fails and your program not handling that case properly.

If you are really concerned about memory leaks, a debug memory manager will help you detect those. One can be found on my devblog, which is an C-Version of the C++ memory manager by Paul Nettle.

Other than that, we cannot help you with your problem, as we don't have enough information.
Hi, thanks for that. I will try that out. I'm running my apps on C++. Therefore I would try the original as well ;o)

I'm pretty sure that the reason are memory leaks or in some circumstences wrong calculated needed memory.

Thanks.
User avatar
Torch
Posts: 825
Joined: Wed May 28, 2008 2:50 am

Post by Torch »

Is there anything like a compile time garbage collection warning system?
a_noob
Posts: 97
Joined: Sun Sep 17, 2006 8:33 am
Location: _start: jr 0xDEADBEEF

Post by a_noob »

It's cool you do not have to listen to me or Raph. We both answered this question.

Code: Select all

.øOº'ºOø.
'ºOo.oOº'
User avatar
Torch
Posts: 825
Joined: Wed May 28, 2008 2:50 am

Post by Torch »

Oh, cool thats exactly what mmgr is. I has no idea. Figured it was some kind of runtime debugging tool (which I normally couldn't be bothered to setup).
a_noob
Posts: 97
Joined: Sun Sep 17, 2006 8:33 am
Location: _start: jr 0xDEADBEEF

Post by a_noob »

It has a few functions. But it basically can log every malloc/calloc and it can also catch memory leaks by watching the pointers handed out via these functions. I have not used it in a while, but I think you could alter some of the code,if it doesn't already have callback support, to cause a callback situation to form a sort of error handler to maybe go back and fix the problem, or reallocate the variable with more data.

Code: Select all

.øOº'ºOø.
'ºOo.oOº'
Post Reply