18 Nov, 2006, Tyche wrote in the 21st comment:
Votes: 0
Aidan said:
I was under the impression that all data structures had to be initialized in the beginning, which is what I was attempting to do. I basically stripped the built-in memory handler out and redid it all with calloc, as that is what I was told was best to use since it initialized everything at 0 automatically.

However, due to massive instability and pulling my hair out, I have temporarily given up on it.

IRT ROM, the only thing individual malloc-free will buy you is the ability to make useful sense of tools like valgrind and electric fence. What ROM does is allocate memory in chunks, sometimes a large fixed length pool in the case of strings. It then keeps track of memory chunks and reuses them. ROM never frees memory; it relies on the operating system to do it upon the close of the process. I call it a high water mark memory system. This is what modern mallocs do internally today. That is Merc/ROM's use of free lists and base 2 divisible (or page divisible) allocation is a simplistic form what you might find under the covers of modern malloc/free.

If you'd like to see a working version that has had the memory system stripped out and converted to new/delete, see the Murk++ codebase in the repository here. It's C++ although you can do the same with malloc/free or calloc/free.
18 Nov, 2006, Aidan wrote in the 22nd comment:
Votes: 0
Thanks Tyche,

I'll take a look at that and go from there.

Thanks everyone for all the help. :)