Solved

TQuery memory leak

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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering 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

Suggested Solutions

Title # Comments Views Activity
How to debug For loops? 3 63
Press three keys together and trigger a function 3 67
control image tags in a string ? 12 154
Delphi and Access based Enumeration 9 78
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…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

696 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