| View previous topic :: View next topic |
| Author |
Message |
willow :--)
Joined: 13 Jan 2007 Posts: 126
|
Posted: Tue Apr 14, 2009 12:06 pm Post subject: Ram fragmentation? |
|
|
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 |
|
 |
Coldbird

Joined: 08 Feb 2007 Posts: 155
|
Posted: Tue Apr 14, 2009 12:15 pm Post subject: |
|
|
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 |
|
 |
willow :--)
Joined: 13 Jan 2007 Posts: 126
|
Posted: Tue Apr 14, 2009 12:18 pm Post subject: |
|
|
| 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 |
|
 |
J.F.
Joined: 22 Feb 2004 Posts: 2906
|
Posted: Tue Apr 14, 2009 4:51 pm Post subject: |
|
|
| 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 |
|
 |
willow :--)
Joined: 13 Jan 2007 Posts: 126
|
Posted: Tue Apr 14, 2009 5:06 pm Post subject: |
|
|
| 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 |
|
 |
jimparis
Joined: 10 Jun 2005 Posts: 1179 Location: Boston
|
Posted: Wed Apr 15, 2009 4:55 am Post subject: |
|
|
| Yes, RAM will fragment. But it shouldn't cause a crash unless you're ignoring malloc() errors or something similar. |
|
| Back to top |
|
 |
willow :--)
Joined: 13 Jan 2007 Posts: 126
|
Posted: Wed Apr 15, 2009 8:51 am Post subject: |
|
|
| 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 |
|
 |
|