alloc_perm should mostly used to allocate structures that have their own free_ and new_ calls (i.e. stuff in recycle.c) and things that are never deallocated (i.e. rooms, mob indexes, obj indexes...). Each data type that's handled in recycle.c has its own memory pool (usually *_free). So memory you allocate with alloc_perm should never be sent to free_mem, it should be permanent or have a specialized memory pool.
alloc_mem and free_mem on the other hand use a generic memory pool and are mostly used to allocate memory for strings. str_dup and free_string are basically just wrappers for alloc_mem and free_mem that allocate and deallocate based on the string's length. free_string and free_mem won't make memory usage go down because memory is never freed once it's allocated, it just gets put back in the general pool. Normally what'll happen is the mud will allocate new memory like crazy for a while after it starts up. Once all of its pools are full, it won't allocate any more. In my experience, memory leaks almost always have to do with strings. For example, in stock Rom there's a potential problem with char_data->material not being free_string'ed by free_char in recycle.c. So potentially every time a char_data is freed, you lose the block of memory that's pointed to by material. So I usually start by looking at all of the char * variables in the structures and make sure they get freed when the structure is. On 1/23/06, Valnir <[EMAIL PROTECTED]> wrote: > Ok, here's a question for you that will probably just make some of you laugh > at me, but I don't care. I need someone to PLEASE explain to me what the > difference is between alloc_perm and alloc_mem in ROM 2.4b6.. I have a slow > memory leak (other day it's not so slow) that makes the perm blocks and > bytes (sAllocPerm and nAllowPerm) steadily increase. The physical RAM usage > obviously goes of with them. If someone can please explain to me the > difference and where each should be used I would be very grateful. If you're > feeling really helpful, maybe you can even explain why free_string and > free_mem don't make it go back down any. > > Any help here is very appreciated. > > Thanks! > > - Valnir > > > > -- > ROM mailing list > [email protected] > Unsubscribe here ->>> http://www.rom.org/cgi-bin/mailman/listinfo/rom > -- ROM mailing list [email protected] Unsubscribe here ->>> http://www.rom.org/cgi-bin/mailman/listinfo/rom

