Memory Allocation Issues

From Planimate Knowledge Base
Jump to navigation Jump to search

Planimate *currently* allocates most RAM using the C run time libraries, which in turn allocate RAM from windows. Once they have allocated memory. Once the RTL has allocated RAM, it isn't returned to Windows until the process quits (for the SC compiler, the VC one seems to release OK).

As memory is allocated/deallocated, it becomes fragmented, split into lots of small blocks which makes reallocating large blocks require more physical memory even though there was plenty of memory free, just not in one block.

For some object types like FEC events and ITEMS, I use a cache to keep a bunch of them around so they are ready to reuse. I may have to do this for portals etc. but it makes PL less stable as its somewhat messy.

After exit the Planiamt.dbg should contain a line of memory info (if it contains more than 1 line, the EXE has debug enabled!!!) and the news and deletss should match. The allocated and freed should differ by 3276 or so. Always check this on exitting PL as it will help identify a leak.

The VC version of Planimate allocates memory from Windows which is swappable, whereas the SC version doesn't. This means the SC version of PL will have serious problems if the models approach the size of PHYSICAL memory.



idkbase note 64