Hi,
If you set the extra memory flag in the make file to use the slim RAM,
will the program fail to load on a PSP1000 straight away even if the extra RAM was not used?
If not, when will the program fail to load on a PSP1000... when a 40Mb array is defined, or when you go to use it?
Slim extra memory Question
Slim extra memory Question
If not actually, then potentially.
It will work fine on both. The only thing that changes is the amount of memory you can allocate dynamically. Mallocs will simple fail after there is no more free memory.
Since malloc uses the heap defined at compile time, you should use a negative value such as PSP_HEAP_SIZE_KB(-1024) instead of a hardcoded value. So you'll have 23MiB on Phat and 55MiB on the Slim with 1MiB for stacks etc in either case.
Or you could not use that heap at all and create one to use at runtime with the sce* functions after detecting Phat or Slim. Since extra memory isn't hardful, just use the PSP_HEAP_SIZE_KB method and allocate extra in your code depending on the model.
If you declare the 40MiB array at compile time then it will obviously fail on the Phat since 40MiB is statically allocated. The program will not work at all. If you have a pointer to the array, then only the 40MiB malloc will fail but you can handle the error.
Since malloc uses the heap defined at compile time, you should use a negative value such as PSP_HEAP_SIZE_KB(-1024) instead of a hardcoded value. So you'll have 23MiB on Phat and 55MiB on the Slim with 1MiB for stacks etc in either case.
Or you could not use that heap at all and create one to use at runtime with the sce* functions after detecting Phat or Slim. Since extra memory isn't hardful, just use the PSP_HEAP_SIZE_KB method and allocate extra in your code depending on the model.
If you declare the 40MiB array at compile time then it will obviously fail on the Phat since 40MiB is statically allocated. The program will not work at all. If you have a pointer to the array, then only the 40MiB malloc will fail but you can handle the error.