Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Memory Leak / Session Object
Message
From
05/11/2003 15:37:05
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Other
Title:
Memory Leak / Session Object
Miscellaneous
Thread ID:
00846763
Message ID:
00846763
Views:
73
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
Next
Reply
Map
View

Click here to load this message in the networking platform