Just out of curiosity, how much this impacts PSX programming? I guess for small applications this may be unnoticeable.Dynamic Memory Allocation and the Heap
(...cut...)
In C, memory allocation is achieved using the malloc and free functions. Unfortunately there have been several problems with these functions on PlayStation.
The standard malloc/free combination supplied as part of libc fragments memory due to a bug in the free function. This means that large chunks on the machine memory become inaccessible even though they are not holding any valid data.
There is a patch for this bug which is used by linking with a file called mmgm.obj (available from the SCEE WEB SITE). This supplies a new function for initialising the heap and replaces the buggy malloc and free with more reliable functions. In this scheme the heap base is unconventionally located at the address ramsize minus the stacksize and the heap “grows†toward the base of memory.
Whilst these functions are better than the originals, they are still comparatively untested. Also they are rather generic. You are strongly recommended to consider developing a memory allocation scheme that is tailored to your specific application, rather than relying on those supplied in the libraries.
An example showing how to implement a simple malloc/free scheme is presented in the Kernighan & Ritchie book The C Programming Language. This text notes that the optimal memory allocation scheme depends on the nature of the application.
Does anyone have more info/experience about this?
Does this issue has ever been solved (to our knowledge) by Sony over time?
Thanks