Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Button calls a form, form returns values, button code co
Message
 
To
29/08/2008 09:58:19
Jay Johengen
Altamahaw-Ossipee, North Carolina, United States
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Environment versions
Visual FoxPro:
VFP 9 SP2
Miscellaneous
Thread ID:
01342942
Message ID:
01344401
Views:
17
This message has been marked as a message which has helped to the initial question of the thread.
Hi Jay,

>A coworker also questioned this method due to possible memory leaks on the created object.

It depends on what these properties contain and how long the object is alive after the form has been released. Normally you wouldn't keep the object around for long after you closed the form. The calling form receives the object, reads all property values and then releases the object. Memory leaks would occur under two circumstances:

a) The property object contains not only simple values, but also object references. In this case you have to set all properties to NULL (or some other value) before the return variable goes out of scope:
DO FORM FormB TO loReturn
* (...) do something with the return values
loReturn.oReference = NULL
loReturn = NULL
b) Form B has a private datasession and you keep the object alive. Since the parameter object belongs to the same datasession as form B, the datasession won't go away until you release the parameter object. Therefore you shouldn't keep the return object, but read the values and release it.
--
Christof
Previous
Reply
Map
View

Click here to load this message in the networking platform