Function

func GC(Bool)

public func GC(heavy!: Bool = false): Unit

Description: Executes GC.

Parameters:

  • heavy!: Bool: GC execution progress. If the value is true, the execution is slow and more memory is collected. The default value is false.

func SetGCThreshold(UInt64)

public func SetGCThreshold(value: UInt64): Unit

Description: Modifies the memory threshold for triggering GC. When the size of a Cangjie heap exceeds the threshold measured in KB, GC is triggered.

Parameters:

  • value: UInt64: memory threshold for triggering GC

Example: Sets the GC memory threshold to 2 MB.

import std.runtime.*
main() {
  SetGCThreshold(2048)
}