Subject: Re: Xsun memory leak?
To: Brad Salai <bsalai@law.roc.servtech.com>
From: Chuck Silvers <chuq@chuq.com>
List: port-sparc
Date: 05/06/1998 09:20:33
my theory on this was that it was horrible memory fragmentation
caused by netscape displaying lots of images of widely varying size,
and the system malloc not dealing with this particularly well.
I hacked up a version of malloc() that uses mmap() to satisfy
requests of more than pagesize, which has the advantage that
freeing these blocks with munmap() will actually release the
memory back to the system. this is at
http://www.chuq.com/netbsd/mmalloc.tar.gz
to build, copy netbsd's src/lib/libc/stdlib/malloc.c into the
mmalloc directory and "make". to use, install the resulting
shared library somewhere and setenv LD_PRELOAD to point to it.
I only use it for my X server (via a .xserverrc), but it
should work for everything.
I haven't had my X server die from lack of memory since then,
but then I've added more RAM and swap to my machine also,
so I'm not sure which is responsible. it was a fun hack
either way. one funny side-effect of this is that memory
allocated with mmap() doesn't show up in ps, so it's hard
to tell how much memory the process is really using anymore.
I wrote another little program to dump a process's vm_map
via /dev/kmem, but the output isn't so useful since it's hard
to tell what's what.
-Chuck
Brad Salai writes:
> I've noticed that Xsun uses more and more memory as time goes on, and
> applications come and go.
>
> It starts out at about 4.5 M and after half a day was up to 19 M.
>
> This is with 1.3.1 binaries, and a -current kernel.
>
> Has anyone else seen this?
>
> Brad
>
>
>
> Brad Salai bsalai@tmonline.com
> Cumpston & Shaw (716) 325-5553
> Two State St.
> Rochester, NY 14526
>
>