]> gitweb.factorcode.org Git - factor.git/blob - core/memory/memory.factor
core: Trim using lists from -tests and clean up a few irregularities.
[factor.git] / core / memory / memory.factor
1 ! Copyright (C) 2005, 2009 Slava Pestov.
2 ! See http://factorcode.org/license.txt for BSD license.
3 USING: alien.strings io.backend kernel memory.private sequences
4 system ;
5 IN: memory
6
7 PRIMITIVE: all-instances ( -- array )
8 PRIMITIVE: compact-gc ( -- )
9 PRIMITIVE: gc ( -- )
10 PRIMITIVE: minor-gc ( -- )
11 PRIMITIVE: size ( obj -- n )
12
13 <PRIVATE
14 PRIMITIVE: (save-image) ( path1 path2 then-die? -- )
15 PRIVATE>
16
17 : instances ( quot -- seq )
18     [ all-instances ] dip filter ; inline
19
20 : saving-path ( path -- saving-path path )
21     [ ".saving" append ] keep
22     [ native-string>alien ] bi@ ;
23
24 : save-image ( path -- )
25     normalize-path saving-path f (save-image) ;
26
27 : save-image-and-exit ( path -- )
28     normalize-path saving-path t (save-image) ;
29
30 : save ( -- ) image-path save-image ;