[freetds] memory leak for connect with db-lib

ldai ldai at accunettech.com
Tue Jun 1 04:35:40 EDT 2004


On Mon, 31 May 2004 11:54:47 -0400, James K. Lowden wrote
> On Mon, 31 May 2004, "ldai" <ldai at accunettech.com> wrote:
> > On Thu, 27 May 2004, ZIGLIO, Frediano, VF-IT wrote
> > > > 
> > > > Hi, everybody:
> > > >     I user freeTDS 0.61-2 rpm to develop db-lib programe to access
> > > >     MS-
> > > > SQLSREVER from linux enrivement. Now I found that I'm just 
> > > > only to connect db 
> > > > and to release connection, it will cost about 200k memory and 
> > > > don't release 
> > > > every time.
> ...
> > > You should call dbinit/dbexit only once.
> ...
> >   I modifed code to call dbinit() and dbexit() only once, but I still
> >   found 
> > the memory leak.
> >   I have developed software in Linux9 and accessed Ms-Sql or Sybase with
> >   
> > freeTDS. I observered the memory leak with "top -p pid" in linux.
> 
> http://dmalloc.com/
> 
> Please give dmalloc a try.  It should help track down what's wrong.  
> If the problem turns out to be in FreeTDS, naturally we'd want it 
> fixed. Patches accepted, too. :-)
> 
> --jkl
> _______________________________________________
> FreeTDS mailing list
> FreeTDS at lists.ibiblio.org
> http://lists.ibiblio.org/mailman/listinfo/freetds
Hi:
  Thank you reply and suggestion.
  I downloaded dmalloc rpm and installed in linux9. I got result, which it 
occured memory leak in call dbstring_concat.Then I found Edward Quackenbush 
[EdwardQuackenbush at symantec.com Thu Jan 29 16:28:21 EST 2004 ]'s report in 
mailing list. He found memory leak during calling dbstring_free function and 
fixed it. I did the same fixed as Edward Quackenbush and tried again.I found 
the code has not occurred memory leak.
  His code is :
--- ../freetds-0.62.1/src/dblib/dblib.c Fri Dec 26 18:11:08 2003 
+++ ../freetds-0.62.1-werking/src/dblib/dblib.c Thu Jan 29 20:18:18 2004 
@@ -737,9 +737,6 @@ 
                if ((*dbstrp)->strnext != NULL) { 
                        dbstring_free(&((*dbstrp)->strnext)); 
                } 
+               if ((*dbstrp)->strtext != NULL) { 
+                       free((*dbstrp)->strtext); 
+               } 
                free(*dbstrp); 
                *dbstrp = NULL; 
        }

  I think he is right. It will occurr memory leak in calling dbstring_free().
  I think it is a bug to be fixed. The memory leak will occurr in linux9.
  Do you think?

Thank your help very much.

Best regards.
                                     leon
                                 1st, June 2004



--
Open WebMail Project (http://openwebmail.org)




More information about the FreeTDS mailing list