🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.database.ado
Article #2091

Re: Memoy Leak In ADODataSet

#2091
From: Andreas Weichert
Date: Tue, 04 Nov 2003 08:34
60 lines
2415 bytes
I found the solution:

TADOConnecction.KeepConnection=false

It seem that wit Keeping Connection On all recources of on database
transaction are not released.

Why ???


"Andreas Weichert" <weichert@trios.de> schrieb im Newsbeitrag
news:3f9d4d4f$2@newsgroups.borland.com...
> Hello !
>
> I use BC-Builder 5.0 and with ADO
> I store large string in an memo filed in an Access-Database.
> I have a leak in every update of ca. twice lenth of the string length.
>
> Here is my exaample code:
>
>     for(int j=0; j<9; j++)
>     {
>         TADODataSet *P = new TADODataSet(NULL);
>         P->Connection=theDataBase.itsCon;
>         P->CommandType = cmdText;
>         P->CommandText = "select * from tblData where IDData='xxxx'";
>         P->Open();
>         P->Edit();
>
>         for(int i=0;i<P->FieldCount;i++)
>         {
>             TString
FieldName=(P->FieldList->Fields[i]->FieldName).c_str();
>             if(FieldName=="Data")
>                 P->FieldList->Fields[i]->AsString=TString(100000,
> 'x').c_str();              // Line   A
>                                             // 100.000 Byte
>         }
>         P->UpdateBatch(arAll);                // Line B
>         P->Close();
>         delete P;
>     }
>     MessageDlg("xxxxx", mtWarning, TMsgDlgButtons() << mbOK, 0);
>
>     ==>>>>   Total loss of  ca. 2 MB;
>
> If I comment Line A   or   B  I have no memory loss
>
> What goes wrong ????????
>
>
>
> Andreas
>
>
>
>
>
>
>
Technical Details
Message-ID: <3fa76408@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!news.maxwell.syr.edu!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail
References: <3f9d4d4f$2@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 10698b,8febaec60325e8c2
X-Google-Attributes: gid10698b,public
X-Google-ArrivalTime: 2003-11-04 00:39:16 PST
From: "Andreas Weichert" <weichert@trios.de>
Newsgroups: borland.public.cppbuilder.database.ado
References: <3f9d4d4f$2@newsgroups.borland.com>
Subject: Re: Memoy Leak In ADODataSet
Date: Tue, 4 Nov 2003 09:34:11 +0100
Lines: 62
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 5.00.2919.6700
X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2919.6700
NNTP-Posting-Host: 217.229.108.24
Message-ID: <3fa76408@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1067934728 217.229.108.24 (4 Nov 2003 00:32:08 -0700)
Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!news.maxwell.syr.edu!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail