Skip to Content.
Sympa Menu

freetds - RE: [freetds] memory leak for connect with db-lib

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: "ldai" <ldai AT accunettech.com>
  • To: FreeTDS Development Group <freetds AT lists.ibiblio.org>, "FreeTDS Development Group" <freetds AT lists.ibiblio.org>
  • Subject: RE: [freetds] memory leak for connect with db-lib
  • Date: Mon, 31 May 2004 14:09:01 +0800

On Thu, 27 May 2004 12:13:44 +0200, 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.
> > How can i deal with problem?
> > Thank very much.
> > leon
> > 2004-05-27
> >
> > F.E:
> > /**
> > getDBLogin.c
> > */
> > LOGINREC *getDBLogin(char sUserName[60], char sPasswd[60])
> > {
> > LOGINREC *login;
> > /* Initialize DB-Library. */
> >
> > dbinit();
> > login = dblogin();
> > DBSETLUSER(login, sUserName);
> > DBSETLPWD(login, sPasswd);
> > DBSETLAPP(login, "Leon-2");
> > return login;
> > }
> >
> > /**
> > getDBproc.c
> > */
> > DBPROCESS *getDBproc(LOGINREC *dbLogin)
> > {
> > DBPROCESS *retProc;
> > retProc = dbopen(dbLogin, NULL);
> > return retProc;
> > }
> >
> > /**
> > main.c
> > */
> > #include <stdio.h>
> > #include <sybfront.h>
> > #include <sybdb.h>
> >
> > main(argc,argv)
> > int argc;
> > char *argv[];
> > {
> > LOGINREC *Ldblogin;
> > DBPROCESS *testProc;
> > int iRetCode=0;
> > char sGetVal[255];
> > char sNewDomain[255];
> > char sRetMsg[1024];
> > char sMsg[1024];
> > int i=0;
> >
> > memset(sNewDomain, 0, sizeof sNewDomain);
> > memset(sRetMsg, 0, sizeof sRetMsg);
> > memset(sMsg, 0, sizeof sMsg);
> > for(i=0; i<1000; i++)
> > {
> > printf("\n-----loop=[%d]-----\n",i);
> > Ldblogin = (LOGINREC *)getDBLogin("test", "test");
> > testProc = (DBPROCESS *)getDBproc(Ldblogin);
> > dbclose(testProc);
> >
> > dbloginfree(Ldblogin);
> > dbexit();
> > }
> > }
> >
>
> You should call dbinit/dbexit only once.
> Try updating. Current release is 0.62.3 (you are using debian, don't
> you?)
>
> freddy77
> _______________________________________________
> FreeTDS mailing list
> FreeTDS AT lists.ibiblio.org
> http://lists.ibiblio.org/mailman/listinfo/freetds


Hi:
Thanks you reply in a short time.
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.
I download 0.62.3 from
http://sunsite.rediris.es/sites2/ibiblio.org/linux/ALPHA/freetds/stable/freetd
s-0.62.3.tar.gz
and install in linux9, but I still get the result of memory leak.
How can I do to avoid thos cases? Did you meet it ?
Please help me.

Thank you very much.

leon
31st,May, 2004





Archive powered by MHonArc 2.6.24.

Top of Page