My application calls malloc in multiple subroutines, finally releasing all using free. This is done using my zalloc library (see my other post: http://www.cplusplus.com/forum/general/128753/ ).
Somehow, when the applications tries to detect the available ammount of memory at the end of the test (allocating, freeing, testing), the freemem function gives me about 4-6MB less memory than at the start of the test? (out of 21MB available on the device at the start).
Anyone knows what can cause this?
All memory is allocated and freed using the malloc/free routines within the library, with the exception of the SDL functions, which are registered externally on allocation and release.
The memory is just allocated using malloc and freed (only with valid pointers or freezall) with free. When just malloc and free are used, can this be caused by other factors (function calls etc.? Afaik they use the stack to store their return parameters, or are the stacks allocated on the heap too? Threads are allocated with sceKernelCreateThread with a 0x10000 stack size ( http://psp.jim.sh/pspsdk-doc/group__ThreadMan.html#gad7e21acdf3aca23200c81f73f69521a3 ))
Edit: seems the library works just fine. The problem was with some allocation/deallocation calls in some other functions and heap corruption with unchecked allocated data (overflow in a malloc area).