>      It says i'm a member of this list but yet I send and send and never
> recieve anything (not even my own post).  But, here goes again.  I believe
> I have a memory leak.  In fact i'm quite sure of it but I have a simple
> logical question first.  I'm running a godwars mud with Rotains OLC (I
> inherited this project *sigh*).  Now then, I keep getting crashes when my
> builders edit (or create) a mob or object in the string fields (ie: name,
> short, long, desc).  So I did some testing and it's very odd to me.  I edit
> a mobs name (test mob), load 2 of them, kill 1 and look and the other mob
> has garbage for it's name.  I get into the editor and find that it's
> changed there aswell.  Soon after this it crashes.  Now I kept a close eye
> on the memory after the kill and before the crash and no changes.  My
> question is if anyone has seen this, why does it do that?  That's also for
> those who might have a clue.  I've use Erwin's LeakTracer program to try
> and find it but no luck.  I've tried to use electric fence, but I can't get
> it to dump (or find where it dumps).  I've even tried hacking up my own
> "leak" finder. Need some help guys...hope you can.

It sounds like a dynamically allocated string is being shared by them all, so 
once it's freed, the pointers in the index are copied over as well.
Make sure that when the mob is created (create_mobile), it uses str_dup to 
copy the strings from the indexes, instead of just setting it to the string 
in the index..  This will make sure each mob has its own copy of non-shared 
strings.
Just setting it would work fine for shared strings (those loaded at boot 
time), but would screw up strings allocated later (such as created with OLC 
or string command).
If that doesn't work, start looking at free_string and str_dup to make sure 
that they treat shared strings correctly.

The "leak finder" is more or less useless for actually finding leaks.. 
because all it tells you is when memory is allocated.  It can't tell you why 
there wasn't any memory available.
All it'll tell you is that a leak exists somewhere if you see it used a lot.

--Palrich.

Reply via email to