Article View: borland.public.cppbuilder.database.ado
Article #1075Re: ADO really leaks memory !!!
From: Viatcheslav V. Vassiliev
Date: Tue, 16 Nov 2004 14:04
Date: Tue, 16 Nov 2004 14:04
196 lines
7809 bytes
7809 bytes
Yes, this should work anytime. I would execute it only from one (main)
thread but it should not affect other threads too. Do not call it too
often - Windows maintains something like memory pool and when it needs to
allocate new memory, it uses this pool. This function clears pool and memory
allocation may become slower. In theory, Windows should sometimes release
unused pages.
//------------------------------------------
Regards,
Vassiliev V. V.
http://www.managed-vcl.com - using .Net objects in Delphi for Win32 +
ADO.Net
http://www.oledbdirect.com - The fastest way to access MS SQL Server,
MS Jet (Access) and Interbase (through OLEDB)
"Roberto" <roberto@dialtech.com.br> �������/�������� � �������� ���������:
news:4199ea19@newsgroups.borland.com...
> This works, thank you !!!
>
> But, I can execute this command any time ? Even if the software is
> executing, for example, a query ??
>
> Thanks a lot again
>
> Roberto.
>
>
> "Viatcheslav V. Vassiliev" <support@oledbdirect.com> wrote in message
> news:4194db3c@newsgroups.borland.com...
> > Does this works, I suggested you this in answer to your previous
message:
> >
> > SetProcessWorkingSetSize(GetCurrentProcess(), -1, -1)
> >
> > //------------------------------------------
> > Regards,
> > Vassiliev V. V.
> > http://www.managed-vcl.com - using .Net objects in Delphi for Win32 +
> > ADO.Net
> > http://www.oledbdirect.com - The fastest way to access MS SQL Server,
> > MS Jet (Access) and Interbase (through OLEDB)
> >
> > "Roberto" <roberto@dialtech.com.br> �������/�������� � ��������
���������:
> > news:4194bc6a$1@newsgroups.borland.com...
> > > Ok but, qhen your application is a w200 service ??
> > >
> > > What can I do ?
> > >
> > > Thanks
> > >
> > > "Viatcheslav V. Vassiliev" <support@oledbdirect.com> wrote in message
> > > news:41948d13@newsgroups.borland.com...
> > > > Yes, this could help - Windows does not return all memory pages to
OS
> > for
> > > > active application but will return when you minimize application.
Look
> > at
> > > > any application in Task Manager when you minimize it.
> > > >
> > > > //------------------------------------------
> > > > Regards,
> > > > Vassiliev V. V.
> > > > http://www.managed-vcl.com - using .Net objects in Delphi for Win32
+
> > > > ADO.Net
> > > > http://www.oledbdirect.com - The fastest way to access MS SQL
Server,
> > > > MS Jet (Access) and Interbase (through OLEDB)
> > > >
> > > > "Roberto" <roberto@dialtech.com.br> �������/�������� � ��������
> > ���������:
> > > > news:4194003f$1@newsgroups.borland.com...
> > > > > Why ??
> > > > >
> > > > > This can help anyway?? What should I expect ??
> > > > >
> > > > > Have you tested the "dummy" app ??
> > > > >
> > > > > Regards
> > > > >
> > > > > Roberto
> > > > >
> > > > > "Viatcheslav V. Vassiliev" <support@oledbdirect.com> wrote in
> message
> > > > > news:4193e213$1@newsgroups.borland.com...
> > > > > > Try minimize/maximize application window and see what happen.
> > > > > >
> > > > > > //------------------------------------------
> > > > > > Regards,
> > > > > > Vassiliev V. V.
> > > > > > http://www.managed-vcl.com - using .Net objects in Delphi for
> Win32
> > +
> > > > > > ADO.Net
> > > > > > http://www.oledbdirect.com - The fastest way to access MS SQL
> > Server,
> > > > > > MS Jet (Access) and Interbase (through OLEDB)
> > > > > >
> > > > > > "Roberto" <roberto@dialtech.com.br> �������/�������� � ��������
> > > > ���������:
> > > > > > news:4193a04b@newsgroups.borland.com...
> > > > > > > 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:
<419a08ec$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!newsread.com!newsprint.newsread.com!logbridge.uoregon.edu!newsfeed.icl.net!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mailReferences:
<4193a04b@newsgroups.borland.com> <4193e213$1@newsgroups.borland.com> <4194003f$1@newsgroups.borland.com> <41948d13@newsgroups.borland.com> <4194bc6a$1@newsgroups.borland.com> <4194db3c@newsgroups.borland.com> <4199ea19@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Thread: 10698b,9cda77443750e1eb X-Google-Attributes: gid10698b,public X-Google-Language: ENGLISH,ASCII From: "Viatcheslav V. Vassiliev" <support@oledbdirect.com> Newsgroups: borland.public.cppbuilder.database.ado References: <4193a04b@newsgroups.borland.com> <4193e213$1@newsgroups.borland.com> <4194003f$1@newsgroups.borland.com> <41948d13@newsgroups.borland.com> <4194bc6a$1@newsgroups.borland.com> <4194db3c@newsgroups.borland.com> <4199ea19@newsgroups.borland.com> Subject: Re: ADO really leaks memory !!! Date: Tue, 16 Nov 2004 17:04:28 +0300 Lines: 198 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: 213.234.218.42 Message-ID: <419a08ec$1@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1100613868 213.234.218.42 (16 Nov 2004 06:04:28 -0700) Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!newsread.com!newsprint.newsread.com!logbridge.uoregon.edu!newsfeed.icl.net!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail