Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

TQuery memory leak

Posted on 1997-11-21
5
Medium Priority
?
340 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

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…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
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

722 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