Solved

TQuery memory leak

Posted on 1997-11-21
5
326 Views
Last Modified: 2010-04-04
How to avoid (or regain) loss of memory after every executed query which returns result set?
So, after each Query1.Open there is los of few K of mem, so evantualy, after couple of thousends requests, there is no more mem to allocate!
0
Comment
Question by:quetzalqoatl
  • 2
  • 2
5 Comments
 
LVL 1

Expert Comment

by:TheSwine
ID: 1351404
What delphi version are you on? 1/2/3 ?

0
 

Author Comment

by:quetzalqoatl
ID: 1351405
Delphi 2 and 3
0
 
LVL 1

Expert Comment

by:TheSwine
ID: 1351406
Can you please also supply the code that maked you think there is a memory leak?
0
 

Author Comment

by:quetzalqoatl
ID: 1351407
Here is some code:

procedure AfterSomeAction;
begin
    Query1.Close;
    Query1.Open;
end;

Simple?
0
 
LVL 1

Accepted Solution

by:
anilms earned 400 total points
ID: 1351408
I am working for a large software company and this is what we do for programs having memory leaks where we use components over which we do not have control :
a. Split the app into two - one containing components/code which has proven memory leaks, and the other will be a plain program calling this at frequent intervals. This will be the parent app.
b. The parent app will call the child app (with memory leaks) and for every n number of such calls (maybe 100 or so), the parent app closes the child app and restarts it once again. The moment the child app is closed, you regain the entire memory leaked.

We were recently developing a "Mail Converter" program for converting mails from 16bit to 32bit systems when we had the same problem - the 16bit system was "leaking memory" and the system would just hang after converting some 80 mails. We divided the app into two and it is now working perfectly. We close the child app and restart it after every 25 mails. The parent app's job is only to close and restart the child app. The child app does most of the work.
0

Featured Post

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
This Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.
In a recent question (https://www.experts-exchange.com/questions/28997919/Pagination-in-Adobe-Acrobat.html) here at Experts Exchange, a member asked how to add page numbers to a PDF file using Adobe Acrobat XI Pro. This short video Micro Tutorial sh…

776 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question