Subject: Re: rpcbind leaks memory?
To: Frank van der Linden <frank@wins.uva.nl>
From: Oleg Polyanski <luke@jetinf.com>
List: current-users
Date: 06/21/2000 20:59:48
Frank van der Linden <frank@wins.uva.nl> writes:

        Boehm'  garbage collector compiled  with debugging printing and being
        preloaded with LD_PRELOAD   shows exhaustive amount  of memory  usage
        information.   Once upon a   time my  co-worker put  LD_PRELOAD  into
        `.xinitrc'.. Heh, after ten or more  minutes he turned X terminal off
        because  there  was   still   no    image   on  the  screen.      And
        `.xsession-errors' wasted all available disk space.

> > Finding memory leaks isn't trivial, but what you could do is insert
> > some code in the main service routines that check the amount of memory
> > that is currently in use. You can do that using the same sysctl that
> > ps and top use, but I don't know what it is offhand.
> 
> Ok, it's easier.. I need more coffee. Since the malloc we use still
> uses brk/sbrk, the return value of sbrk(0) can be used to check
> for malloc leaks, although that will only signal problems after some
> iterations (i.e. the malloc function will reserve space using brk/sbrk,
> only when it has run out of previously reserved space, so if you check
> for this, you will not immediately see the problem).
> 
> There are probably libraries out there that will instrument every
> malloc/free operation, allowing you to check things better. Something
> like mallinfo().
> 
> Off to get some coffee now,
> 
> - Frank