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 ENDFUNCRunning this code and viewing the Performance monitor you’ll see the counter climb in the memory usage.