Board index » delphi » Memory Leak

Memory Leak

I have an application that loops through large tables in a database and does
some processing. The problem is that I run out of memory after a while and I
have determined that the leak is not caused by my code but by the BDE. I set
up a project that loops through the table just calling 'Next' until EOF and
the same memory leak occurs.
Is there a setting similair to the CursorLocation(clUseServer) in ADO that I
can use in my App? I suspect that may be the issue
Thanks,
 

Re:Memory Leak


Quote
"Beny" <IBene...@AdmitComputer.com> wrote in message

news:3b617bd9_1@dnews...

Quote
> I have an application that loops through large tables in a database and
does
> some processing. The problem is that I run out of memory after a while and
I
> have determined that the leak is not caused by my code but by the BDE. I
set
> up a project that loops through the table just calling 'Next' until EOF
and
> the same memory leak occurs.
> Is there a setting similair to the CursorLocation(clUseServer) in ADO that
I
> can use in my App? I suspect that may be the issue

Simply looping through records should not exhibit any memory leak. What does
happen is every record is cached in memory as you loop through them. How
many records are you looping through? Also, what database are you using? You
can try setting Unidirectional to True on the TQuery to see if that helps.

--
Wayne Niddery (Logic Fundamentals, Inc.)
RADBooks: http://www.logicfundamentals.com/RADBooks/delphibooks.html
"Some see private enterprise as a predatory target to be shot, others as a
cow to be milked, but few are those who see it as a sturdy horse pulling the
wagon." - Winston Churchill

Re:Memory Leak


Thanks for your quick response,

I tried your suggestion to set Unidirectional to True however I did not see

any improvement. I'm seeing this happen on several different databases, I

just tested this with a FoxPro Database and got the same results.

The tables have anywhere between 20K and 500K records.

"Wayne Niddery [TeamB]" <wnidd...@aci.on.ca> wrote in message
news:3b61878b_1@dnews...

Quote
> "Beny" <IBene...@AdmitComputer.com> wrote in message
> news:3b617bd9_1@dnews...
> > I have an application that loops through large tables in a database and
> does
> > some processing. The problem is that I run out of memory after a while
and
> I
> > have determined that the leak is not caused by my code but by the BDE. I
> set
> > up a project that loops through the table just calling 'Next' until EOF
> and
> > the same memory leak occurs.
> > Is there a setting similair to the CursorLocation(clUseServer) in ADO
that
> I
> > can use in my App? I suspect that may be the issue

> Simply looping through records should not exhibit any memory leak. What
does
> happen is every record is cached in memory as you loop through them. How
> many records are you looping through? Also, what database are you using?
You
> can try setting Unidirectional to True on the TQuery to see if that helps.

> --
> Wayne Niddery (Logic Fundamentals, Inc.)
> RADBooks: http://www.logicfundamentals.com/RADBooks/delphibooks.html
> "Some see private enterprise as a predatory target to be shot, others as a
> cow to be milked, but few are those who see it as a sturdy horse pulling
the
> wagon." - Winston Churchill

Re:Memory Leak


Hi,

With the following code, the program runs out of memory after enough
clicks.

procedure TForm1.BitBtn1Click
begin
 Clientdataset1.next;
end;
While not ClientDataSet1.bof do
begin
 Clientdataset1.prior;
end;
while not ClientDataSet1.eof do
begin
 Clientdataset1.next;
end;

Clientdataset1.close;

end;

Removing the close statement will solve this in this example.

Question is there a way to close the dataset and freeing the memory,
used by it, without destroying the dataset ?

Erik

Other Threads