Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Memory Leak / Session Object
Message
 
 
To
05/11/2003 15:37:05
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00846763
Message ID:
00846844
Views:
27
Bob,
When you issue a SCATTER NAME, you create a new object. Why should releasing the session object, which has NOTHING to do with the scatter name object, release the new object?

Objects live in the datasession they are created which is probably why the datasession isn't closed until you release the scattered object. However, datasessions are not bound to objects. If something is still attached to the datasession, it won't go away.

Regards.

>If one were to create a session object then issue a Scatter Name command while in the Datasession of the session object that was created then release the session object with out releasing the reference to the Scatter Name, the Datasession will stay in memory until the reference to the scatter name is either out of scope or explicitly released. Here is some sample code that will recreate the problem.
>
>
>
>test()
>set step on && All datasession will close scatter name out of scope
>
>FUNCTION test()
>
>LOCAL sDatasession, sRecord, sMacroCommand
>
>  sDatasession    = "oSession"
>  sRecord         = "oRec"
>  sMacroCommand   = ""
>  FOR i = 1 TO 10000
>     sMacroCommand = sDataSession + ALLTRIM(STR(i)) + " = CREATEOBJECT('sessionbase')"
>     &sMacroCommand  && Create a session object
>     sMacrocommand = "set datasession to " + sDataSession + ALLTRIM(STR(i)) + ".Datasessionid"
>     &sMacroCommand  && set to session object datasessionid
>     sMacroCommand = "scatter name " + sRecord + ALLTRIM(STR(i))
>     &sMacroCommand  && issue scatter name
>     sMacroCommand = "release " + sDataSession + ALLTRIM(STR(i))
>     &sMacroCommand  && release the Session object
>
>     && this will fix the problem but shouldn't be necessary.
>     && shouldn't the session object do this for you?
>*!*     sMacroCommand = "release " + sRecord + ALLTRIM(STR(i))
>*!*     &sMacroCommand && explicitly release the ref to scatter name
>
>    ENDFOR
>    Set step on  && many datasession will be open at this point
>ENDFUNC
>
>
>
>Running this code and viewing the Performance monitor you’ll see the counter climb in the memory usage.
>
>So my question is this, When the session object is released why isn't the reference to the scatter name released as well. It appears that the scatter name keep the datasession open when you'd think it wouldn't.
>
>Is this a VFP Bug? Any thoughts
>
>
>BW
Larry Miller
MCSD
LWMiller3@verizon.net

Accumulate learning by study, understand what you learn by questioning. -- Mingjiao
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform