in my project I am using a kernel bootloader to load a full kernel prx ... the whole stuff was working until I declared 2 static buffer sized 3.000.000 bytes each, that cause the loader to fail on sceKernelLoadModule() with memory allocation error.
I guess that the problem is that kernel code has 8Mb of memory to use.
I guess at this point that I have to allocate memory (maybe in user space) ... how can I do it in a full kernel prx, can I use malloc ?
I think no otherwise I would include no-kernel libs.
Anybody can give me a hint ?
Thanks.
kernel prx and allocation
Well the total free memory for a kernel app on 1.5 is around 600KiB only, you cannot load more than that into kernel ram (you get maybe 150KiB more on 1.0 _but_ when loadexec starts up reboot that will fail instead if you are low on memory).
You should just be able to use normal malloc from newlib in your application, that will allocate a heap in user memory (assuming you have any left), alternatively use sceKernelAllocPartitionMemory and sceKernelGetBlockHeadAddr with partition 2 to allocate user memory directly, although you will have to probably segment it up manually.
You should just be able to use normal malloc from newlib in your application, that will allocate a heap in user memory (assuming you have any left), alternatively use sceKernelAllocPartitionMemory and sceKernelGetBlockHeadAddr with partition 2 to allocate user memory directly, although you will have to probably segment it up manually.