Message
From
05/04/2017 09:00:32
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Other
Title:
VFP 9 Collections and memory leaks
Miscellaneous
Thread ID:
01649799
Message ID:
01649799
Views:
139
Hi you all,

Just a quick question for those of you who have used and abused VFP end-of-life additions, VFP collections.

Up to now, I resisted the urge to use VFP collections. They a bit clumsy as compared to the support for them in say python and a couple of other languages ones. But well I decided to use them for a relatively complex VFP task (with text and xml-via-com parsing).

The good news: it worked and was reasonable simple. The bad one: memory leaks and COM -(and VFP-based) objects lost at runtime.

I first had the initial bad reaction most have in front of mem leaks - nobody like these dangling references ! I then read a nice post by Rick Strahl on his great web site. Once i was back to life... I decided to replace a couple of collections with arrays. It worked wonderfully. The garbage collector would get back to work. Good news:)

I still have numbers of VFP collections in this relatively complex pack of code. A few questions on VFP collection good practices:

1) Would you recommend that I drop them all ? Or can we safely keep them for basic purposes such as collection of integers !
2) Can you safely add and remove them dynamically with ADDOBJECT and REMOVEOBJECT and expect the garbage to be collected?

Daniel
Next
Reply
Map
View