Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Insufficient Memory?

Status
Not open for further replies.

lespaul

Programmer
Feb 4, 2002
7,083
US
While testing my program I tend to have to run things over and over and eventually I get an error that there is insuffient memory from the server for this operation. I assume it is because some of the queries in the datamodule aren't properly closed. If I place DataModule.Free in the OnClose event of my main form (once it is closed the program is over), will that ensure that all the queries are closed as well? Or do i need to loop through all the components on the datamodule and set active to false for all queries? Once the query is not active does that implicitly mean that all the datasets are closed as well?
Thanks! Leslie
landrews@metrocourt.state.nm.us

SELECT * FROM USERS WHERE CLUE > 0
No Rows Returned
 
Hi Leslie,

I dont know the DataModule, but if have a more common information:
If you free resources it's better to do it in the OnDestroy event, because OnClose and OnCloseQuery will not be used, if you close your program with Application.Terminate.
OnDestroy is more reliable.

Bye
Chris
 
active equal to false will not solve the problem u have to close the queries and tables which are open and then destroy
the datamodule
 
Are you creating a lot of stuff with .create(nil) ? I think this may leave stray things hanging about as they don't have an owner. Try to create things with .Create(self) so that when the owner is destroyed, it will subsequently destroy components owned by it.

lou (I am trying - alot of people have told me that).
 
No I'm not creating anything with create(nil) (in fact, I don't know that I would know how to create anything at this point! I am still in the Delphi Baby Pool!). In fact, I'm not even sure that the DataModule is my problem. Since I first started having this Insufficient Memory error, I have been trying to explictly set each query to active := false when I'm done using it. And I would assume that when the program closes that the DataModule would be Destroyed. Perhaps something is happening on my Database server that I'm unaware of. Leslie
landrews@metrocourt.state.nm.us

SELECT * FROM USERS WHERE CLUE > 0
No Rows Returned
 
Insufficient Memory, it looks like an operating systems problem. Are you running Windows ME?, do you have a lot of other programs open? winamp, antivirus. With ME the amount of icons in the right side of the taskbar is proportional to the amount of memory problems. Maybe you are running multiple instances of the program and try to debug it at the same time.
Steven van Els
SAvanEls@cq-link.sr
 
I'm using Windows 2000 on a network with an AS400 database (which is what the queries are hitting). I haven't had the problem quite as much since I did Free on the Close event of the main program form.

Thanks!

Leslie
landrews@metrocourt.state.nm.us

SELECT * FROM USERS WHERE CLUE > 0
No Rows Returned
 
It's likely that you have either a memory leak or a resource leak. You're allocating something and not freeing it.
 
How can I find out what's not being freed? I have JMSData.Free in the FormClose of my main program form and all my queries are in JMSData. Leslie
landrews@metrocourt.state.nm.us

SELECT * FROM USERS WHERE CLUE > 0
No Rows Returned
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top