]> gitweb.factorcode.org Git - factor.git/blob - core/memory/memory.factor
f9daf425e81dbac8fd603025179107192dd7fe72
[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 -- )
15 PRIMITIVE: (save-image-and-exit) ( path1 path2 -- )
16 PRIVATE>
17
18 : instances ( quot -- seq )
19     [ all-instances ] dip filter ; inline
20
21 : saving-path ( path -- saving-path path )
22     [ ".saving" append ] keep
23     [ native-string>alien ] bi@ ;
24
25 : save-image ( path -- )
26     normalize-path saving-path (save-image) ;
27
28 : save-image-and-exit ( path -- )
29     normalize-path saving-path (save-image-and-exit) ;
30
31 : save ( -- ) image save-image ;