Link to home
Start Free TrialLog in
Avatar of YousefEisa
YousefEisa

asked on

problems with freemem when closing a file

My Delphi 7 program seems to behave well when it is running on Windows XP.  Yet the same program running onWindows  Server 2003 gives an error when I clos ethe program down, citing problems with Freeing up memory. is there much difference bewteen the two platforms when it comes to running Delphi (version 7). If Xp cannot find a problem, how can I find out what is wrong.

I create a number of dynamic arrays while the program is running. My  Closing instruction (when the user stops the program) is to use the finalze procedure to kill off the dynamic arrays.  Do I have to close them in any particular order?  When using XP it seems to make no difference if I finalise the dyanamic arrays or not. The program just closes down without a pronblem. It appears that Delphi 7 must embed some code to free the memory used up by dyanaic arrays.  

I notice that Delphi 2005 says that it is targetted to XP as well as to Server 2003. I wonder if I should complie my application under Delphi 2005.


SOLUTION
Avatar of TheRealLoki
TheRealLoki
Flag of New Zealand image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Madshi
Madshi

Delphi 7 is fully compatible with 2003. The problem must be with your code. Generally you don't need to finalize dynamic arrays. Delphi does it for you. And even if it wouldn't, Windows would in the end also do it for you.

Make sure you have stopped all threads (as TheRealLoki already said) before letting your app shut down.
Avatar of YousefEisa

ASKER

Thanks guys for the quick response.
My program is single threaded and i do not use timers. some dynamic arrays are global and stay active until the propgram ends. Other dynamic arrays are created within procedures but I close them before the procedures finishes.

I use setlength a lot dealing with strings to dynamically change their size. I am assuming that I do not have to wory about these as they are initially defined as string variables within functions or procedures.

But what is puzzling is that if there is something wrong with my code, why does the program behave well on XP, and gives me an error when running on Windows Server? Is XP more tolerant?
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial