4.9. Garbage Collector

SQInteger sq_collectgarbage(HSQUIRRELVM v)
Parameters:
  • v (HSQUIRRELVM) – the target VM
Remarks:

this api only works with garbage collector builds (NO_GARBAGE_COLLECTOR is not defined)

runs the garbage collector and returns the number of reference cycles found (and deleted)

SQRESULT sq_resurrectunreachable(HSQUIRRELVM v)
Parameters:
  • v (HSQUIRRELVM) – the target VM
Remarks:

this api only works with garbage collector builds (NO_GARBAGE_COLLECTOR is not defined)

runs the garbage collector and pushes an array in the stack containing all unreachable object found. If no unreachable object is found, null is pushed instead. This function is meant to help debug reference cycles.