46 lines
2.2 KiB
Plaintext
46 lines
2.2 KiB
Plaintext
IN: memory
|
|
USING: errors help test tools ;
|
|
|
|
HELP: data-gc ( -- )
|
|
{ $description "Performs a full garbage collection." } ;
|
|
|
|
HELP: code-gc ( -- )
|
|
{ $description "Collects all generations up to and including tenured space, and also collects the code heap." } ;
|
|
|
|
HELP: gc-time ( -- n )
|
|
{ $values { "n" "a timestamp in milliseconds" } }
|
|
{ $description "Outputs the total time spent in garbage collection during this Factor session." }
|
|
{ $examples "This word is used by " { $link time } " to measure the time spent in garbage collection during the execution of a quotation." } ;
|
|
|
|
HELP: data-room ( -- cards semi generations )
|
|
{ $values { "cards" "number of bytes reserved for card marking" } { "semi" "number of bytes reserved for tenured semi-space" } { "generations" "array of free/total bytes pairs" } }
|
|
{ $description "Queries the runtime for memory usage information. Use " { $link room. } " for a pretty memory usage display." } ;
|
|
|
|
{ data-room code-room } related-words
|
|
|
|
HELP: code-room ( -- code-free code-total )
|
|
{ $values { "code-free" "bytes free in the code heap" } { "code-total" "total bytes in the code heap" } }
|
|
{ $description "Queries the runtime for memory usage information. Use " { $link room. } " for a pretty memory usage display." } ;
|
|
|
|
HELP: size ( obj -- n )
|
|
{ $values { "obj" "an object" } { "n" "a size in bytes" } }
|
|
{ $description "Outputs the size of the object in memory, in bytes. Tagged immediate objects such as fixnums and " { $link f } " will yield a size of 0." } ;
|
|
|
|
HELP: room.
|
|
{ $description "Prints an overview of memory usage broken down by generation and zone." } ;
|
|
|
|
HELP: heap-stats
|
|
{ $values { "counts" "a hashtable mapping class words to integers" } { "sizes" "a hashtable mapping class words to integers" } }
|
|
{ $description "Outputs a pair of hashtables, holding class instance counts and instance memory usage, respectively." } ;
|
|
|
|
HELP: heap-stats.
|
|
{ $description "For each class, prints the number of instances and total memory consumed by those instances." } ;
|
|
|
|
|
|
HELP: save-image ( path -- )
|
|
{ $values { "path" "a path name string" } }
|
|
{ $description "Saves a snapshot of the heap to the given file, overwriting the file if it already exists." } ;
|
|
|
|
HELP: save
|
|
{ $description "Saves a snapshot of the heap to the current image file." } ;
|