Garbage collection – BrightSign BrightScript 2 Reference Guide User Manual
Page 19

19
Garbage Collection
BrightScript will automatically free strings when they are no longer used, and it will free
objects when their reference count goes to zero. This is done at the time the object or
string is no longer used; there is no background garbage collection task. This results in
very predictable “garbage collection” -- there are no unexpected stalls in execution.
A “mark and sweep” garbage collection is run after a script executes, or can be manually
forced to run via the debug console. There is currently no way to run it from a script,
and it doesn‟t currently run in the background. Its purpose is to clean up objects that
refer to themselves or have other circular references (which are not managed by the
normal reference counting garbage collection).
i=roCreateObject(“roInt”)
j=I „ reference incremented
i=invalid „ reference decremented
j=0 „ roInt just free‟d.