Multiuser Lingo Dictionary > Multiuser Lingo Dictionary > sweep()

 

sweep()

Syntax

sweep().free()	
sweep().status()

Description

Multiuser Server server-side command; deletes orphaned objects. Objects such as lists, script objects, and so on. can become orphaned if they contain mutual references to one another. If list A contains a reference to list B and list B contains a reference to list A, simply deleting list A will not work, since a reference to it still exists in list B.

Sweep().status() returns a list of all objects in the current thread that are currently orphans. It is a good idea during debugging to check whether your code is creating orphans unintentionally. Call sweep().status() during idle time only every few seconds, since visiting every object and checking its status is CPU intensive.

Sweep().free() deletes these orphaned objects and free the memory they were consuming.

Example

These statements test for the presence of orphaned objects in the current thread and deletes any that are found:

if sweep().status() <> [] then
	sweep().free()
end if

See also

stackSize