Zelix KlassMaster - Documentation

The gc Statement

The ZKM Script gc statement asks the Virtual Machine to perform garbage collection then puts its thread to sleep for a certain number of milliseconds. Whether garbage collection actually takes place depends upon the particular Virtual Machine. The statement puts its thread to sleep because, in some environments, garbage collection can take place asynchronously so it can be useful to give it time to do its work.

In theory, this option should not be required. In practice, with some Virtual Machines and when memory is low, it can be handy place this statement prior to one that will perform a memory intensive operation. If you are not having any memory problems then ignore this option.


gc;       //Ask for garbage collection then sleep for 500ms - the default.

gc 1000;  //Ask for garbage collection then sleep for 1000ms.


"gc" [integerLiteral] ";"

where integerLiteral is the number of milliseconds to sleep. The default is 500ms.
ZKM Script saveAll statement The ZKM Script Language ZKM Script execute statement