This is a replacement I've developed and tested for code validation and recycling common especially in rom muds.
This actually does the job better, and error checks, without needing additonal code every time types of structures are made.
The main functions that are used from this are
void *recycle_malloc(t_int ofsize);
void recycle_free(void *location);
bool validate_memory(void *location);
Basically in new_obj or new_char or new_room you would simple use this instead of the code that typically looks for a recyclable node.
OBJ_DATA *obj = (OBJ_DATA*)recycle_malloc(sizeof(OBJ_DATA));
Also all memory allocated using recycle_malloc() is automatically initialized to 0.
When you free it instead of looking to put it into some recycle queue like rom does you would simple call recycle_free on it.
validate_memory replaces the memory validation systems many muds use. It lets you know if a pointer is valid at any given time efficiently. It's useful when you may have a pointer to some memory that may have already been invalidated and freed. You can do
if (validate_memory(any_ptr)) // Yes, it is valid
And check on the fly.
The basics of the system that make it interesting is that it uses chunk and piece logic. Single malloc calls and distribution of memory from that single malloc call to anything that needs it. It keeps information on pointers given out in _mem_info structure. It's expansive enough to eventually be able to tell which line/file/function the memory was given to. Currently it does not allow double freeing but doesn't do anything about it. Just won't crash your game to free something 100 times. Depending on the logging system a game could handle this and other errors this produces better to help with debugging, or even help with memory problems before it become evident from a data corruption stand point.