Subject: Re: rpcbind leaks memory?
To: Juergen Hannken-Illjes <hannken@eis.cs.tu-bs.de>
From: Frank van der Linden <frank@wins.uva.nl>
List: current-users
Date: 06/21/2000 10:16:36
On Wed, Jun 21, 2000 at 09:59:18AM +0200, Frank van der Linden wrote:
> 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