What
Set mYVariable = nothing
does, is to decrese the reference count of the myVariable object. myVariable will be destroyed only the rerefence count goes to zero. In your case
Set oFunctionRS = oTempRS
increases the reference count of oTempRS, therefore even though in your code you set oTempRS to nothing that will NOT be destroy oTempRS, because someone else (in this case oFunctionRS) is still using it.
Objects are set to nothing automaticall when they go out of scope. Local variables when the local method exits, global variables when the module they belong to terminate etc. I usually set objects to nothing only when I am done with them and I just want to release the memory; but because I like to write small methods with short lifespan, I do not bother.
Hope this helps (I know is quite of confusing)
Marco
|