🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

ADO really leaks memory !!!

#1055
From: Roberto
Date: Thu, 11 Nov 2004 18:28
69 lines
2594 bytes
Hello Gentlemans

I have done a dummy application:

void __fastcall TForm1::Button1Click(TObject *Sender)
{
    int i;
    cn->ConnectionString = "Provider=SQLOLEDB.1;Password=sa;Persist Security
Info=True;User ID=sa;Initial Catalog=Dialtech;Data Source=rbook";
    cn->LoginPrompt = false;
    cn->Connected = true;
    for(i = 0;i<100;i++)
    {
        TADOQuery *x = new TADOQuery(NULL);
        x->Connection = cn;
        x->SQL->Text = "SELECT * FROM USUARIOS";
        x->Prepared = true;
        x->Open();
        Sleep(50);
        x->Close();
        delete x;
        Application->ProcessMessages();
    }

}
//--------------------------------------------------------------------------
-

void __fastcall TForm1::Button2Click(TObject *Sender)
{
    int i;
    for(i = 0;i<100;i++)
    {
        TQuery *x = new TQuery(NULL);
        x->DatabaseName = "db";
        x->SQL->Text = "SELECT * FROM USUARIOS";
        x->Prepared = true;
        x->Open();
        Sleep(50);
        x->Close();
        delete x;
        Application->ProcessMessages();
    }
}


button 1: 100 queries dinamically created using ADO
button 2: 100 queries dinamically created using BDE.

Running the to portions I have noted:

ADO: Memory allocated initially: ~8MB
            Memory after 100 queries: 12.5MB

BDE: Memory allocated initially: ~8MB
        Memory after 100 queries: ~8MB

And more: BDE is faster and uses less processor time

I�m using BCB5 but tested on BCB6 with same results.

All upddates available was installed;

I�m doing something wrong with ADO ???????????

Thanks a lot.


Roberto
Technical Details
Message-ID: <4193a04b@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!newsread.com!newsprint.newsread.com!news.glorb.com!newsfeeder.wxs.nl!border2.nntp.ams.giganews.com!nntp.giganews.com!news-hub.cableinet.net!blueyonder!news-peer-test!btnet!newsfeed.bt.es!caladan.landsraad.net!newsgroups.borland.com!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Thread: 10698b,9cda77443750e1eb,start
X-Google-Attributes: gid10698b,public
X-Google-Language: ENGLISH,ASCII
From: "Roberto" <roberto@dialtech.com.br>
Newsgroups: borland.public.cppbuilder.database.ado
Subject: ADO really leaks memory !!!
Date: Thu, 11 Nov 2004 15:28:18 -0300
Lines: 71
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1437
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1441
NNTP-Posting-Host: 200.171.183.217
Message-ID: <4193a04b@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1100193867 200.171.183.217 (11 Nov 2004 09:24:27 -0700)
Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!newsread.com!newsprint.newsread.com!news.glorb.com!newsfeeder.wxs.nl!border2.nntp.ams.giganews.com!nntp.giganews.com!news-hub.cableinet.net!blueyonder!news-peer-test!btnet!newsfeed.bt.es!caladan.landsraad.net!newsgroups.borland.com!not-for-mail