diff --git a/TODO.FACTOR.txt b/TODO.FACTOR.txt index b3ea2a335f..cdd2a68a0e 100644 --- a/TODO.FACTOR.txt +++ b/TODO.FACTOR.txt @@ -2,11 +2,9 @@ - x86 %box-struct - x86 %write-barrier -- bundle freetype .dylib in the .app on OS X - x11 title bars are funny - x11 wheel mouse test - changelog in the UI -- set resource path to image parent directory - amd64 %box-struct + portability: diff --git a/library/kernel.factor b/library/kernel.factor index e8be77526b..0a79475942 100644 --- a/library/kernel.factor +++ b/library/kernel.factor @@ -105,3 +105,11 @@ IN: kernel : win32? windows? cell 4 = and ; inline : win64? windows? cell 8 = and ; inline + +IN: memory + +: generations ( -- n ) 15 getenv ; + +: image ( -- path ) 16 getenv ; + +: save ( -- ) image save-image ; diff --git a/library/kernel.facts b/library/kernel.facts index 115eeddfc2..88296b04a1 100644 --- a/library/kernel.facts +++ b/library/kernel.facts @@ -1,4 +1,4 @@ -USING: generic help kernel kernel-internals sequences ; +USING: generic help kernel kernel-internals memory sequences ; HELP: eq? "( obj1 obj2 -- ? )" { $values { "obj1" "an object" } { "obj2" "an object" } } @@ -246,3 +246,18 @@ HELP: set-array-nth "( elt n array -- )" { $values { "elt" "an object" } { "n" "a non-negative fixnum" } { "array" "an array" } } { $description "Low-level array element mutator." } { $warning "This word is in the " { $snippet "kernel-internals" } " vocabulary because it is unsafe. It does not check types or array bounds, and improper use can corrupt memory." } ; + +HELP: generations "( -- n )" +{ $values { "n" "a positive integer" } } +{ $description "Outputs the number of generations partitioning the heap." } ; + +HELP: image "( -- path )" +{ $values { "path" "a path name string" } } +{ $description "Outputs the path name of the currently running Factor image." } ; + +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." } ; diff --git a/library/tools/memory.factor b/library/tools/memory.factor index 6ecc314fcf..fdd18466e7 100644 --- a/library/tools/memory.factor +++ b/library/tools/memory.factor @@ -5,14 +5,8 @@ USING: arrays errors generic hashtables io kernel kernel-internals lists math namespaces parser prettyprint sequences strings vectors words ; -: generations ( -- n ) 15 getenv ; - : full-gc ( -- ) generations 1 - gc ; -: image ( -- path ) 16 getenv ; - -: save ( -- ) image save-image ; - ! Printing an overview of heap usage. : kb. diff --git a/library/tools/memory.facts b/library/tools/memory.facts index ed52b12d56..aa157c0c0b 100644 --- a/library/tools/memory.facts +++ b/library/tools/memory.facts @@ -1,24 +1,9 @@ IN: memory USING: help ; -HELP: generations "( -- n )" -{ $values { "n" "a positive integer" } } -{ $description "Outputs the number of generations partitioning the heap." } ; - HELP: full-gc "( -- )" { $description "Performs a full garbage collection." } ; -HELP: image "( -- path )" -{ $values { "path" "a path name string" } } -{ $description "Outputs the path name of the currently running Factor image." } ; - -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." } ; - HELP: room. "( -- )" { $description "Prints an overview of memory usage broken down by generation and zone." } ;