I was investigating an out-of-memory crash, and I found that malloc doesn't alloc all available memory:
Code: Select all
int tmalloc = 0;
while (malloc(1024) != NULL)
tmalloc += 1024;
/* while (malloc(1024*1024) != NULL) */
/* tmalloc += 1024*1024; */
printf("tmalloc = %d\n", tmalloc);
/* FW 1.50 => 10910720 / 10485760 (normally 24000kB) */
/* FW 5.00 => 39819264 / 39845888 (normally 52500kB) */
I'm running the tests on a PSP2, first with firmware 1.50(+3.40hw), then from 5.00 M33-6, compiled as .prx and run from PSPLink.
My .prx is around 2.2.MB.
When I strip my application to get a minimal main that only does the test, I go back to 53000k.
Any clue? :)
Btw, even with a minimal program and just checking sceKernelTotalFreeMemSize(), we loose 8-10MB from the start (24M PSP1 / 53M PSP2). How comes? :/