Subject: Re: rpcbind leaks memory?
To: Frank van der Linden <frank@wins.uva.nl>
From: Simon Burge <simonb@netbsd.org>
List: current-users
Date: 06/22/2000 14:31:07
Frank van der Linden wrote:

> On Tue, Jun 20, 2000 at 12:38:10PM +0200, Juergen Hannken-Illjes wrote:
> > It looks like rpcbind leaks memory. Function handle_reply for example
> > allocates a buffer of 64k without release. Is there a tool to trace 
> > these allocations that are not freed.
> 
> I did notice a few days ago that it was leaking, but I haven't been
> able to find all causes yet.  Thanks for finding that one; I checked in
> the obvious fix. It is still leaking somewhat, though, so some more
> checking needs to be done. If you could help: great, I'm pretty busy
> with other stuff at the moment.

A little bit of playing shows that a malloc() for 16 bytes is called
with each incoming request (I used rusers as a test), but that free()
isn't called.  Here's the trace at where it's called:

	(gdb) bt
	#0  0x804edf5 in malloc ()
	#1  0x480e6ddf in calloc ()
	#2  0x480be72f in svc_dg_create ()
	#3  0x480bf5b0 in _svc_getreq_common ()
	#4  0x480bf72f in svc_getreq_poll ()
	#5  0x804d2b2 in my_svc_run ()
	#6  0x804b1fa in main ()
	#7  0x804a431 in ___start ()

From there it got a little to twisty to see what was going on - what can
I do to help from here...

Simon.