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.
PSP and memory allocation
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.
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.
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.
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=4784cyphre 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.