Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
VFP 9 Collections and memory leaks
Message
From
06/04/2017 05:32:43
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
 
To
05/04/2017 09:00:32
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
01649799
Message ID:
01649843
Views:
66
>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

I am not a fan of collections and I don't use them. Arrays and custom (and mostly "Empty") object does good for me in most cases.
I chimed in to ask about that "text and xml via com parsing". That sounds to be a bigger problem. I would try keeping away from COM unless absolutely needed. Maybe you could parse via XMLAdapter and remove the need to collections completely?
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform