re-use of dbprocess structure (was: Re: [freetds] state of dbrpcsend())

liam at liam at
Fri Jul 9 02:47:19 EDT 2004

On Thu, Jul 08, 2004 at 11:50:58AM +0200, Frediano Ziglio wrote:

> > Unless there are some objections (or offers) I'll start trying to patch
> > the apparent numerous memory leaks in 0.62.4.
> > 
> This patch should fix the problem (committed in 0.63, not in 0.62)

Thanks. I also sent a similar patch to James before you sent yours.
Unfortunately, there is still a more subtle memory leak that I've
been trying to track down.

The test code leaks approximately 96-120 bytes per 1,000 interations. I 
would expect that the leak variance between execution is due to page 
fragementation but I'll take other suggestions. However, it is still 
very puzzling as I would expect a consistent leak for every iteration
not one page per 40 interations. Maybe a bad realloc() somewhere?

I've re-compiled FreeTDS with dmalloc, removed -O2 and added -g. 
The dmalloc report has libc functions like nss_* and dlopen_* on the
not freed list which is probably okay. I did however see that
strdup() and tsearch() were also on the list which is suspicious.

I think dbcancel() needs to be modified to clear out the RPC 
structure and any paramaters so it can be called after use but I
don't know if this is an appropriate course of action interms of
other vendor impementations of dblib.

I need to get rid of this memory leak, any other suggestions on what
else it might be?


More information about the FreeTDS mailing list