| View previous topic :: View next topic |
| Author |
Message |
cyphre
Joined: 04 Apr 2006 Posts: 2
|
Posted: Tue Apr 04, 2006 10:35 am Post subject: PSP and memory allocation |
|
|
Hello all.
I'm a newbie to PSP programming. I'm trying to allocate memory using the malloc() function but the PSP always freeze once I allocate more than one block of 2MB size.(ie second 2MB block cannot be allocated and I'm getting this in my error log just before the PSP freeze:
malloc 65536 by rtarea
malloc 2097152 by fast
malloc 65536 by filesys
malloc 524288 by kick
malloc 2097152 by chip
Fatal error: out of memory for chipmem.
)
I suppose there is 32MB of memory avaliable?
(My first attempt is to enhance emulated memory in PSPUAE Amiga emulator - http://www.kaillera.com/pspuae/pspuae-0.41-src.zip)
Is there any good information about the PSP memory and its proper handling/usage when doing homebrew apps?
Thanks for any tips, hints etc. and sorry if this topic was discussed already here. |
|
| Back to top |
|
 |
PeterM
Joined: 31 Dec 2005 Posts: 125 Location: Edinburgh, UK
|
Posted: Wed Apr 05, 2006 3:20 am Post subject: |
|
|
I don't think all the 32MB is available for allocation. Depending on your memory usage and global/static data size you'll probably find it's closer to 20-25MB.
Which kinda sucks... |
|
| Back to top |
|
 |
subbie
Joined: 05 May 2005 Posts: 122
|
Posted: Wed Apr 05, 2006 3:23 am Post subject: |
|
|
I though 24MB is open to an app (the 8MB is locked away by the kernal for prx modules).
Of that 24MB you must take into consideration stack space, static varibles & the application it self.
Yet other then that you still have alot to work with. I'm having no problem loading up 16MB rom files for my n64 emu. |
|
| Back to top |
|
 |
cyphre
Joined: 04 Apr 2006 Posts: 2
|
Posted: Wed Apr 05, 2006 5:07 am Post subject: |
|
|
Yeah, I read somewhere that 8MB is used as 'kernel space' and the rest 24MB is used for 'application space'.
I also know that other apps(emulators etc.) are able to allocate quite big chunks of mem. So that's why I wonder what could be the problem with the Amiga emulation. I think 24megs should be sufficient.
Is there a way how to get currently used/free memory at runtime?
I even tried to use sceKernelTotalFreeMemSize() and sceKernelMaxFreeMemSize() methods from PSPSDK package to see how much memory on the PSP is available but I got strange results:
total free mem 1028096bytes
max free mem block 966656bytes
Any help from PSP homebrew coding guru is appreciated. |
|
| Back to top |
|
 |
johnmph
Joined: 23 Jul 2005 Posts: 119
|
Posted: Wed Apr 05, 2006 6:26 am Post subject: |
|
|
| cyphre wrote: | Yeah, I read somewhere that 8MB is used as 'kernel space' and the rest 24MB is used for 'application space'.
I also know that other apps(emulators etc.) are able to allocate quite big chunks of mem. So that's why I wonder what could be the problem with the Amiga emulation. I think 24megs should be sufficient.
Is there a way how to get currently used/free memory at runtime?
I even tried to use sceKernelTotalFreeMemSize() and sceKernelMaxFreeMemSize() methods from PSPSDK package to see how much memory on the PSP is available but I got strange results:
total free mem 1028096bytes
max free mem block 966656bytes
Any help from PSP homebrew coding guru is appreciated. |
http://forums.ps2dev.org/viewtopic.php?t=4784 |
|
| Back to top |
|
 |
|