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 Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Memory Leak?

Status
Not open for further replies.

GriffMG

Programmer
Mar 4, 2002
6,334
FR
I have a small VFP App that scans a database every four minutes. It does a number of housekeeping tasks including resizing some bitmap files (using an OCX tool), sending some e-mails (using West-Wind tools), creating some zip files (using vfpcompression.fll) and deleting some redundant zip files.

The first few times it's run it is really quick, but gets very slow after about 40 iterations and today ran out of memory at the 70th iteration or so.

I've created a kludge to make the app reload itself after 25 iterations to be getting on with, but is there a better way? Which part is more likely to be causing the problem?

I have a similar program that makes far fewer zip files and doesn't include the image tool - which runs for months on end with no problems.

Any help, as always, gratefully received!


Regards

Griff
Keep [Smile]ing
 
Have you tried running the app in the debug mode and check for memory variables and objects not being released??


David W. Grewe Dave
 
Not yet...

Good idea though!

Regards

Griff
Keep [Smile]ing
 
There could be a memory leak in your ocx or even WW if you're continually creating and releasing an object.
What I mean is, I ran into an instance once where I was doing something like this:
Code:
STORE LOADPICTURE('TRFFC10A.ICO') TO oGreenLight
THISFORM.ostatusbar1.ostatusBar.panels(1).Picture = ;
oGreenLight

I didn't realize it at first, but instead of performing the LOADPICTURE() once in the form init, I was doing it every time I needed to change the picture. Obviously, I would eventually run out of memory.

You may need to verify you are doing:
Code:
oSomeObject = .NULL.
RELEASE oSomeObject

before trying to create another of the same type.


-Dave Summers-
[cheers]
Even more Fox stuff at:
 
Thanks to Dave and Dave...

I *think* I have found the problem, and because it came from an unexpected source - I thought I'd share it.

The app had a main form which was always visible, on that I had a simple edit box which I was using as a running log.

I kept appending a line to the top each time the process did something (date, time and event).

I changed that for a table and a grid instead - and ran it 25 times without any measurable degradation in speed!

I think VFP (6 in this case) is perhaps not very good at managing the memory associated with a constantly changing edit box?

It's out in the wild now, on half a dozen remote servers, so we'll see how the week progresses.

Martin

Regards

Griff
Keep [Smile]ing
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top