Board index » delphi » TQuery.UnPrepare doesn't free resources

TQuery.UnPrepare doesn't free resources

I made just a simple form which has a button on it and
a following procedure which just opens and closes a paradox
table:

procedure TForm1.Button1Click(Sender: TObject);
var
  Query: TQuery;
begin
  Query:=TQuery.Create(nil);
  Query.SQL.Add('SELECT * FROM ClientDB\UserInfo;');
  Query.Prepare;
  Query.Open;
  Query.Close;
  Query.UnPrepare;
  Query.Free;
end;

When I push the button, Windows task manager shows that
memory consumption jumps from 1832kB to 4632kB. Most of
the memory is consumed by TQuery.Prepare. TQuery.UnPrepare does
nothing to return the memory to the OS.

Shouldn't the memory consumption stay the same? I have destroyed
everything I've created. Is this a bug or is there a way to make
the program return all the memory back to the OS?

 

Re:TQuery.UnPrepare doesn't free resources


Quote
Marko wrote:

> When I push the button, Windows task manager shows that
> memory consumption jumps from 1832kB to 4632kB. Most of
> the memory is consumed by TQuery.Prepare. TQuery.UnPrepare does
> nothing to return the memory to the OS.

> Shouldn't the memory consumption stay the same?

        The numbers displayed in Windows Task Manager have little direct
correspondence to the actual amount of memory in use by your app.

        -Craig

--
Craig Stuntz (TeamB)       Senior Developer, Vertex Systems Corp.
Delphi/InterBase weblog:   http://delphi.weblogs.com
Use Borland servers; posts via others are not seen by TeamB.
For more info, see http://www.borland.com/newsgroups/genl_faqs.html

Re:TQuery.UnPrepare doesn't free resources


"Craig Stuntz (TeamB)" <cstuntz@no_spam.vertexsoftware.com> wrote:

Quote
>    The numbers displayed in Windows Task Manager have little direct
>correspondence to the actual amount of memory in use by your app.

>    -Craig

Thank you. Is there a way to know the real amount of memory that the program uses (in case I have to look for memory leaks from a more complicated program)?

Marko

Re:TQuery.UnPrepare doesn't free resources


Get a copy of TurboPowers QASleuth.

--
Adroit Software Ltd
------------------------------
Remove the nospam. to mail me direct

Quote
"Marko" <mmikk...@paju.oulu.fi> wrote in message news:3b04c2f0$1_1@dnews...

> "Craig Stuntz (TeamB)" <cstuntz@no_spam.vertexsoftware.com> wrote:
> > The numbers displayed in Windows Task Manager have little direct
> >correspondence to the actual amount of memory in use by your app.

> > -Craig

> Thank you. Is there a way to know the real amount of memory that the

program uses (in case I have to look for memory leaks from a more
complicated program)?
Quote

> Marko

Re:TQuery.UnPrepare doesn't free resources


Quote
Brian Jones wrote:

> Get a copy of TurboPowers QASleuth.

        Less convenient, but if you're financially challenged, you can use
NT/2000 performance monitor to look at the Private Bytes for the
process.

        HTH,

        -Craig

--
Craig Stuntz (TeamB)       Senior Developer, Vertex Systems Corp.
Delphi/InterBase weblog:   http://delphi.weblogs.com
Use Borland servers; posts via others are not seen by TeamB.
For more info, see http://www.borland.com/newsgroups/genl_faqs.html

Re:TQuery.UnPrepare doesn't free resources


Less convient - but far more precise and useful :) Private bytes will not
identify where the memory leaks are occurring - QA Sleuth will pay for
itself in just time saved faffing about.

--
Adroit Software Ltd
------------------------------
Remove the nospam. to mail me direct
"Craig Stuntz (TeamB)" <cstuntz@no_spam.vertexsoftware.com> wrote in message
news:3B05272E.C1D7A099@no_spam.vertexsoftware.com...

Quote

> Brian Jones wrote:

> > Get a copy of TurboPowers QASleuth.

> Less convenient, but if you're financially challenged, you can use
> NT/2000 performance monitor to look at the Private Bytes for the
> process.

> HTH,

> -Craig

> --
> Craig Stuntz (TeamB)       Senior Developer, Vertex Systems Corp.
> Delphi/InterBase weblog:   http://delphi.weblogs.com
> Use Borland servers; posts via others are not seen by TeamB.
> For more info, see http://www.borland.com/newsgroups/genl_faqs.html

Re:TQuery.UnPrepare doesn't free resources


Quote
"Craig Stuntz (TeamB)" wrote:

> Brian Jones wrote:

> > Get a copy of TurboPowers QASleuth.

>         Less convenient, but if you're financially challenged, you can use
> NT/2000 performance monitor to look at the Private Bytes for the
> process.

Or use MemProof which is free.

--
Jeff Overcash (TeamB)
      (Please do not email me directly unless  asked. Thank You)
Anyone who cannot cope with mathematics is not fully human.
At best he is a tolerable subhuman who has learned to wear
shoes, bathe and not make messes in the house.   (Heinlein)

Other Threads