freetds AT lists.ibiblio.org
Subject: FreeTDS Development Group
List archive
- From: "ZIGLIO, Frediano, VF-IT" <Frediano.Ziglio AT vodafone.com>
- To: "FreeTDS Development Group" <freetds AT lists.ibiblio.org>
- Subject: RE: [freetds] memory leak for connect with db-lib
- Date: Thu, 27 May 2004 12:13:44 +0200
>
> 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] memory leak for connect with db-lib,
ldai, 05/26/2004
- <Possible follow-up(s)>
-
RE: [freetds] memory leak for connect with db-lib,
ZIGLIO, Frediano, VF-IT, 05/27/2004
-
RE: [freetds] memory leak for connect with db-lib,
ldai, 05/31/2004
- Re: [freetds] memory leak for connect with db-lib, James K. Lowden, 05/31/2004
-
RE: [freetds] memory leak for connect with db-lib,
ldai, 05/31/2004
Archive powered by MHonArc 2.6.24.