Re: Memory issues.

"Valnir" <[email protected]>
Newsgroups gmane.games.devel.mud.rom
Message-ID <[email protected]>
Ok.. maybe this will help to point where a lot of memory leaks are.

I opened up a duplicate copy of my mud on our dev port and logged in. While 
running "top" at the shell, to watch the mem usage of the process, I went 
and killed one of our high level mobs, using mortal weapons and spells.

Mem Usage Before Fight: 10460k
Mem Usage After Fight: 10580k

Now mind you, I am the ONLY one logged in there. Any thoughts?

- Valnir

----- Original Message ----- 
From: "Michael Barton" <[email protected]>
To: <[email protected]>
Sent: Wednesday, April 06, 2005 10:19 AM
Subject: Re: Memory issues.


>> #3  0x486d176d in sprintf () from /lib/libc.so.6
>> #4  0x0807127e in do_mstat (ch=0x4956017c, argument=0x487afd24 "8,\023") 
>> at
>> act_wiz.c:2143
>
> The problem's probably with a call to sprintf on that line in act_wiz.
> Look at the buffer size and how much is being copied into it, make
> sure none of the arguments are uninitialized (might contain junk data
> that never has a terminator).
> Consider using snprintf instead of sprintf, since it shouldn't write
> over the buffer if used correctly.
>
> What happens is, sprintf will gladly copy more into the buffer than it
> can hold.  The buffer sits in memory right next to where the arguments
> are stored (in the "stack"), so they get written over once sprintf has
> gone beyond the buffer.  So your arguments basically contain junk now.
> So the memory's corrupt, and that's all gdb has when it goes to drop
> a core.
>
>> act_comm.c:108:48: New fresh storage (type char *) passed as implicitly 
>> temp
>>                       (not released): capitalize(ch->name)
>>   A memory leak has been detected. Storage allocated locally is not 
>> released
>>   before the last reference to it is lost. (Use -mustfreefresh to inhibit
>>   warning)
>
> Take everything splint tells you with a grain of salt. :)
> It's not super smart, it's just looking for things that statistically
> often cause problems.  Use it to find areas of the game to double
> check.
>
> --Palrich.
> -- 
> 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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.