Re: Memory leaks found by DMALLOC?
Brandon Long <[email protected]>
| Newsgroups | gmane.text.clearsilver.general |
|---|---|
| Organization | Fiction L Networks |
| Message-ID | <20070731210431.GD26757@bl1> |
Anything that returns a NEOERR is allocating memory on error. You must
check the return value and call one of the methods to free the data,
usually one of:
nerr_log_error
nerr_ignore
nerr_handle
See util/neo_err.h for details.
The uListInit one is probably from nerr_init, which allocates a very
small amount of memory once.
Brandon
On 07/31/07 raphael.huck uttered the following other thing:
> Hi,
>
> Here's what I've found with DMALLOC:
>
> $ dmalloc_summarize.pl fastcgi < fastcgi.10983
> size count gross function
> 1494 401044 total
> 284 1364 387376 ra=0x436818
> 1176 9 10584 _err_alloc+64> and ends at 0x43681c
> <_err_alloc [neo_err.c:59]
> 240 2 480 hcreate_r
> 16 4 64 check_resize+76> and ends at
> 0x4389a8 <check_resize [ulist.c:37]
> 20 3 60 uListInit+68> and ends at 0x438a5c
> <uListInit [ulist.c:61]
>
>
>
> The part which leaks the most memory is around 0x436818, which is:
>
> $ mips-linux-objdump -S fastcgi | grep -A 21 -B 25 436818
> static NEOERR *_err_alloc(void)
> {
> 4367d0: 3c1c0fbd lui gp,0xfbd
> 4367d4: 279c2c10 addiu gp,gp,11280
> 4367d8: 0399e021 addu gp,gp,t9
> 4367dc: 27bdffe0 addiu sp,sp,-32
> 4367e0: afbf0018 sw ra,24(sp)
> 4367e4: afbc0010 sw gp,16(sp)
> NEOERR *err;
>
> if (!UseFreeList || FreeList == NULL)
> 4367e8: 8f828018 lw v0,-32744(gp)
> 4367ec: 8f878018 lw a3,-32744(gp)
> {
> err = (NEOERR *)calloc (1, sizeof (NEOERR));
> 4367f0: 8f9988dc lw t9,-30500(gp)
> 4367f4: 8c4325d0 lw v1,9680(v0)
> 4367f8: 2405011c li a1,284
> 4367fc: 10600004 beqz v1,436810 <_err_alloc+0x40>
> 436800: 24040001 li a0,1
> 436804: 8ce625cc lw a2,9676(a3)
> 436808: 14c0000d bnez a2,436840 <_err_alloc+0x70>
> 43680c: 8fbf0018 lw ra,24(sp)
> 436810: 0320f809 jalr t9
> 436814: 00000000 nop
> 436818: 8fbc0010 lw gp,16(sp)
> if (err == NULL)
> {
> ne_warn ("INTERNAL ERROR: Unable to allocate memory for
> NEOERR");
> return INTERNAL_ERR;
> }
> return err;
> 43681c: 00402821 move a1,v0
> 436820: 8f848024 lw a0,-32732(gp)
> 436824: 8f998aa4 lw t9,-30044(gp)
> 436828: 1040000f beqz v0,436868 <_err_alloc+0x98>
> 43682c: 24844130 addiu a0,a0,16688
> }
> else
> {
> err = FreeList;
> FreeList = FreeList->next;
> }
> err->flags |= NE_IN_USE;
> err->next = NULL;
> return err;
> }
>
> These seem to be memory leaks. Can anyone confirm?
>
> --Raphaël HUCK
>
>
>
>
> Yahoo! Groups Links
>
>
>
--
Windows NT crashed.
I am the Blue Screen of Death.
No one hears your screams.
-- Peter Rothman http://www.fiction.net/blong/