Quote:
I actually have it set up in that way, but it is only set up for a single struct, i.e. the linked list only keeps track of the memory allocated for a struct, than free's everything automatically. Just wondering if there was a generic way to do it so i could manage all memory in an application. Is there a garbage collecting library, or something out there already that people use?
Sure -- you could just have your linked list node structure contain a void pointer. A void pointer can point to any type, and yet you can still free() it, so it works out. Other information you might want to store might include a reference count (if you're going to all this trouble you might as well), and perhaps the size of the block, along with other information like the file and line where the block was allocated (__FILE__ and __LINE__). Having all this extra information can often help you debug your program, if you feel like implementing it.