🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Memoy Leak In ADODataSet

#2154
From: Andreas Weichert
Date: Mon, 27 Oct 2003 16:54
40 lines
1955 bytes
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: <3f9d4d4f$2@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!fu-berlin.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 10698b,8febaec60325e8c2,start
X-Google-Attributes: gid10698b,public
X-Google-ArrivalTime: 2003-10-27 09:10:42 PST
From: "Andreas Weichert" <weichert@trios.de>
Newsgroups: borland.public.cppbuilder.database.ado
Subject: Memoy Leak In ADODataSet
Date: Mon, 27 Oct 2003 17:54:23 +0100
Lines: 47
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: 80.130.26.16
Message-ID: <3f9d4d4f$2@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1067273551 80.130.26.16 (27 Oct 2003 08:52:31 -0700)
Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!fu-berlin.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail