malloc error when reallocating?

Anyone knows what can cause a fail of malloc allocating less memory than available? It can allocate 2.1MB of memory, but cannot allocate 2.0MB of memory?

File with the routines:
src: http://superfury.heliohost.org/cplusplus/zalloc.c

nzalloc() allocates memory.
freez() deallocates memory.
freemem() detects free memory.
(un)registerptr() registers pointers for use with nzalloc/freez, allowing them to keep a list of allocated resources. They are called manually by routines that allocate memory without malloc (data returned by libraries, over which I have no control using malloc/free).

Anyone knows what's going wrong here? My software starts, but when I reset (use freez on almost all gotten pointers (except two that never change, which are allocated at the start of the software, before the main function starts)), next allocate the new data, it crashes allocating the memory used by the MMU emulation.
Last edited on
Topic archived. No new replies allowed.