forums.ps2dev.org Forum Index forums.ps2dev.org
Homebrew PS2, PSP & PS3 Development Discussions
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

How to detect memory leaks ?

 
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Development
View previous topic :: View next topic  
Author Message
anmabagima



Joined: 01 Oct 2009
Posts: 96

PostPosted: Mon Dec 14, 2009 3:59 am    Post subject: How to detect memory leaks ? Reply with quote

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
Back to top
View user's profile Send private message
m0skit0



Joined: 02 Jun 2009
Posts: 226

PostPosted: Mon Dec 14, 2009 4:03 am    Post subject: Reply with quote

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.
Back to top
View user's profile Send private message
Raphael



Joined: 17 Jan 2006
Posts: 646
Location: Germany

PostPosted: Mon Dec 14, 2009 4:10 am    Post subject: Reply with quote

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
Back to top
View user's profile Send private message Visit poster's website
a_noob



Joined: 17 Sep 2006
Posts: 97
Location: _start: jr 0xDEADBEEF

PostPosted: Mon Dec 14, 2009 4:18 am    Post subject: Reply with quote

You can also use mmgr to look for memory leaks if you still believe that is the cause.
_________________
Code:
.øOº'ºOø.
'ºOo.oOº'
Back to top
View user's profile Send private message AIM Address MSN Messenger
anmabagima



Joined: 01 Oct 2009
Posts: 96

PostPosted: Mon Dec 14, 2009 6:09 am    Post subject: Reply with quote

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 ;)
Back to top
View user's profile Send private message
anmabagima



Joined: 01 Oct 2009
Posts: 96

PostPosted: Mon Dec 14, 2009 6:11 am    Post subject: Reply with quote

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.
Back to top
View user's profile Send private message
Torch



Joined: 28 May 2008
Posts: 842

PostPosted: Mon Dec 14, 2009 1:47 pm    Post subject: Reply with quote

Is there anything like a compile time garbage collection warning system?
Back to top
View user's profile Send private message
a_noob



Joined: 17 Sep 2006
Posts: 97
Location: _start: jr 0xDEADBEEF

PostPosted: Mon Dec 14, 2009 4:45 pm    Post subject: Reply with quote

It's cool you do not have to listen to me or Raph. We both answered this question.
_________________
Code:
.øOº'ºOø.
'ºOo.oOº'
Back to top
View user's profile Send private message AIM Address MSN Messenger
Torch



Joined: 28 May 2008
Posts: 842

PostPosted: Mon Dec 14, 2009 5:52 pm    Post subject: Reply with quote

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).
Back to top
View user's profile Send private message
a_noob



Joined: 17 Sep 2006
Posts: 97
Location: _start: jr 0xDEADBEEF

PostPosted: Tue Dec 15, 2009 12:58 am    Post subject: Reply with quote

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:
.øOº'ºOø.
'ºOo.oOº'
Back to top
View user's profile Send private message AIM Address MSN Messenger
Display posts from previous:   
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Development All times are GMT + 10 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group