std.runtime Package

Function Description

The runtime package is used to interact with the runtime environment of a program. It provides a series of functions and variables for controlling, managing, and monitoring the execution of the program.

Cangjie uses an automatic garbage collection system for memory management. The runtime package provides functions such as manually triggering garbage collection, setting garbage collection thresholds, and obtaining memory statistics for controlling and monitoring garbage collection.

API List

Function

NameDescription
GC(Bool)Performs garbage collection (GC).
SetGCThreshold(UInt64)Modifies the memory threshold for triggering GC. When the size of a Cangjie heap exceeds the threshold measured in KB, GC is triggered.

Struct

NameDescription
MemoryInfoProvides APIs for obtaining heap memory statistics.
ThreadInfoProvides APIs for obtaining statistics of Cangjie threads.