Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

TQuery memory leak

Posted on 1997-11-21
5
Medium Priority
?
342 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 1200 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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
Want to learn how to record your desktop screen without having to use an outside camera. Click on this video and learn how to use the cool google extension called "Screencastify"! Step 1: Open a new google tab Step 2: Go to the left hand upper corn…
In response to a need for security and privacy, and to continue fostering an environment members can turn to for support, solutions, and education, Experts Exchange has created anonymous question capabilities. This new feature is available to our Pr…
Suggested Courses

876 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