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 

Ram fragmentation?

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



Joined: 13 Jan 2007
Posts: 126

PostPosted: Tue Apr 14, 2009 12:06 pm    Post subject: Ram fragmentation? Reply with quote

Hi, I'm in a situation very similar to that one: http://forums.ps2dev.org/viewtopic.php?t=3318&highlight=fragmentation

I am loading/freeing lots of objects of various sizes (from a few dozen bytes to several MB), quite a lot.
After a while, the PSP crashes, apparently when trying to load a huge image (I need to calculate exactly, but the texture probably takes more than 1MB in Ram).

The most obvious culprit is a memory leak somewhere in my code, but is it theoretically possible that, with loading/freeing lots of various objects, I reached a state where my RAM is fragmented and unable to allocate space for a huge block of data ?
Back to top
View user's profile Send private message
Coldbird



Joined: 08 Feb 2007
Posts: 155

PostPosted: Tue Apr 14, 2009 12:15 pm    Post subject: Reply with quote

Doesnt have to be a leak... maybe you just load too much shit at once...
Keep in mind that depending on how many modules and stuff is loaded you can easily max out the 24MB of useable RAM...
_________________
Been gone for some time. Now I'm back. Someone mind getting me up-2-date?
Back to top
View user's profile Send private message MSN Messenger
willow :--)



Joined: 13 Jan 2007
Posts: 126

PostPosted: Tue Apr 14, 2009 12:18 pm    Post subject: Reply with quote

Coldbird wrote:
Doesnt have to be a leak... maybe you just load too much shit at once...
Keep in mind that depending on how many modules and stuff is loaded you can easily max out the 24MB of useable RAM...

No, the game works fine for a while, it fails at a state where the quantity of Ram needed is supposed to be "stabilized"
Back to top
View user's profile Send private message
J.F.



Joined: 22 Feb 2004
Posts: 2906

PostPosted: Tue Apr 14, 2009 4:51 pm    Post subject: Reply with quote

Well then, the obvious thing to do here is to put an extra check at the allocation function(s) and goto a special debugger routine when allocation fails just to see what's going on.
Back to top
View user's profile Send private message AIM Address
willow :--)



Joined: 13 Jan 2007
Posts: 126

PostPosted: Tue Apr 14, 2009 5:06 pm    Post subject: Reply with quote

J.F. wrote:
Well then, the obvious thing to do here is to put an extra check at the allocation function(s) and goto a special debugger routine when allocation fails just to see what's going on.

Yes. I was thinking of using one of the tricks I saw here numerous time (calling malloc with a growing number of bytes to determine the maximum size block).
I just wanted to make sure that "Ram fragmentation" is something that actually happens, or if it's just something I made up. (I don't know how the malloc algorithms work precisely)
Back to top
View user's profile Send private message
jimparis



Joined: 10 Jun 2005
Posts: 1179
Location: Boston

PostPosted: Wed Apr 15, 2009 4:55 am    Post subject: Reply with quote

Yes, RAM will fragment. But it shouldn't cause a crash unless you're ignoring malloc() errors or something similar.
Back to top
View user's profile Send private message
willow :--)



Joined: 13 Jan 2007
Posts: 126

PostPosted: Wed Apr 15, 2009 8:51 am    Post subject: Reply with quote

jimparis wrote:
Yes, RAM will fragment. But it shouldn't cause a crash unless you're ignoring malloc() errors or something similar.

true. Unfortunately a lib is doing the mallocs (and ignoring the errors) for me :)
Back to top
View user's profile Send private message
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