Solved

TQuery memory leak

Posted on 1997-11-21
5
319 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

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

Suggested Solutions

This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
This video discusses moving either the default database or any database to a new volume.
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

757 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

Need Help in Real-Time?

Connect with top rated Experts

24 Experts available now in Live!

Get 1:1 Help Now