Master Detail Queries - Memory Issue...

Please excuse the long posting, but a bit of explanation is required for

this problem...

I am writing an application which relys on several sets of queries.
These queries are often strung together in various Master-Detail
structures. As an example I might have a TQuery "qryMaster" with a field

"MyValue", a Datasource pointing to "qryMaster" and another TQuery,
"qryDetail" pointing to the Datasource with the SQL something like
"Select * from mytable where MyField = :MyValue".
I navigate them something like this:
    qryMaster.Open;
    qryDetail.Open;
    while not qryMaster.EOF do
    begin
        while not qryDetail.EOF do
        begin
             //do stuff
            qryDetail.Next;
        end;
        qryMaster.Next;
    end;
    qryDetail.Close;
    qryMaster.Close;

While the loop is executing, I see the Used Memory steadily climb
(sometimes dangerously high), but for no obvious reason. What would
cause this? The only explanation I can think of is that since qryDetail
is executed everytime the current record on qryMaster changes,
individual qryDeatil objects are being created and not freed. However, I

have no idea how to handle this better.

Any Help would be apreciated.
Kevin Gipe
kg...@ldsltd.com