change the (relatively new) argument to collect-garbage
Make the argument a symbol, 'major or 'minor, instead of a boolean, because that allows further extension.
This commit is contained in:
parent
c416db91c1
commit
81ee1b39c7
|
@ -12,7 +12,7 @@
|
|||
|
||||
(define collection 'multi)
|
||||
|
||||
(define version "6.2.900.16")
|
||||
(define version "6.2.900.17")
|
||||
|
||||
(define deps `("racket-lib"
|
||||
["racket" #:version ,version]))
|
||||
|
|
|
@ -287,24 +287,28 @@ collection mode, the text has the format
|
|||
]}
|
||||
|
||||
|
||||
@defproc[(collect-garbage [minor? any/c #f]) void?]{
|
||||
@defproc[(collect-garbage [request (or/c 'major 'minor) 'major]) void?]{
|
||||
|
||||
Forces an immediate @tech{garbage collection} (unless garbage
|
||||
collection is disabled by setting @envvar{PLTDISABLEGC}). Some
|
||||
effectively unreachable data may remain uncollected, because the
|
||||
collector cannot prove that it is unreachable.
|
||||
|
||||
If @racket[minor?] is false, then a major collection is
|
||||
run. Otherwise, a minor collection is run or no collection is run. (No
|
||||
The @racket[collect-garbage] procedure provides some control over the
|
||||
timing of collections, but garbage will obviously be collected even if
|
||||
this procedure is never called (unless garbage collection is disabled).
|
||||
|
||||
If @racket[request] is @racket['major], then a major collection is
|
||||
run. If @racket[request] is @racket['minor], then either a minor
|
||||
collection is run or no collection is run (and no
|
||||
collection occurs when @racket[(system-type 'gc)] returns
|
||||
@racket['cgc] or when a normally scheduled minor collection would
|
||||
cause a major collection.) Minor collections run by
|
||||
cause a major collection); minor collections triggered by
|
||||
@racket[collect-garbage] do not cause major collections to run any
|
||||
sooner than they would have otherwise.
|
||||
|
||||
The @racket[collect-garbage] procedure provides some control over the
|
||||
timing of collections, but garbage will obviously be collected even if
|
||||
this procedure is never called (unless garbage collection is disabled).}
|
||||
@history[#:changed "6.2.900.17" @elem{Added the @racket[request] argument.}]}
|
||||
|
||||
|
||||
@defproc[(current-memory-use [cust custodian? #f]) exact-nonnegative-integer?]{
|
||||
|
||||
|
|
|
@ -3,6 +3,10 @@
|
|||
|
||||
(Section 'wills)
|
||||
|
||||
(collect-garbage 'major)
|
||||
(collect-garbage 'minor)
|
||||
(err/rt-test (collect-garbage 'other))
|
||||
|
||||
(test #t exact-nonnegative-integer? (current-memory-use))
|
||||
(test #t exact-nonnegative-integer? (current-memory-use #f))
|
||||
(test #t exact-nonnegative-integer? (current-memory-use (current-custodian)))
|
||||
|
|
|
@ -13,12 +13,12 @@
|
|||
consistently.)
|
||||
*/
|
||||
|
||||
#define MZSCHEME_VERSION "6.2.900.16"
|
||||
#define MZSCHEME_VERSION "6.2.900.17"
|
||||
|
||||
#define MZSCHEME_VERSION_X 6
|
||||
#define MZSCHEME_VERSION_Y 2
|
||||
#define MZSCHEME_VERSION_Z 900
|
||||
#define MZSCHEME_VERSION_W 16
|
||||
#define MZSCHEME_VERSION_W 17
|
||||
|
||||
#define MZSCHEME_VERSION_MAJOR ((MZSCHEME_VERSION_X * 100) + MZSCHEME_VERSION_Y)
|
||||
#define MZSCHEME_VERSION_MINOR ((MZSCHEME_VERSION_Z * 1000) + MZSCHEME_VERSION_W)
|
||||
|
|
|
@ -243,6 +243,7 @@ THREAD_LOCAL_DECL(struct Scheme_GC_Pre_Post_Callback_Desc *gc_prepost_callback_d
|
|||
|
||||
ROSYM static Scheme_Object *read_symbol, *write_symbol, *execute_symbol, *delete_symbol, *exists_symbol;
|
||||
ROSYM static Scheme_Object *client_symbol, *server_symbol;
|
||||
ROSYM static Scheme_Object *major_symbol, *minor_symbol;
|
||||
|
||||
THREAD_LOCAL_DECL(static int do_atomic = 0);
|
||||
THREAD_LOCAL_DECL(static int missed_context_switch = 0);
|
||||
|
@ -521,6 +522,11 @@ void scheme_init_thread(Scheme_Env *env)
|
|||
client_symbol = scheme_intern_symbol("client");
|
||||
server_symbol = scheme_intern_symbol("server");
|
||||
|
||||
REGISTER_SO(major_symbol);
|
||||
REGISTER_SO(minor_symbol);
|
||||
major_symbol = scheme_intern_symbol("major");
|
||||
minor_symbol = scheme_intern_symbol("minor");
|
||||
|
||||
GLOBAL_PRIM_W_ARITY("dump-memory-stats" , scheme_dump_gc_stats, 0, -1, env);
|
||||
GLOBAL_PRIM_W_ARITY("vector-set-performance-stats!", current_stats , 1, 2, env);
|
||||
|
||||
|
@ -713,10 +719,14 @@ void scheme_init_paramz(Scheme_Env *env)
|
|||
|
||||
static Scheme_Object *collect_garbage(int argc, Scheme_Object *argv[])
|
||||
{
|
||||
if (argc == 1 && !SCHEME_FALSEP(argv[0])) {
|
||||
if (argc == 1 && SAME_OBJ(minor_symbol, argv[0])) {
|
||||
scheme_collect_garbage_minor();
|
||||
} else {
|
||||
} else if ((argc < 1) || SAME_OBJ(major_symbol, argv[0])) {
|
||||
scheme_collect_garbage();
|
||||
} else {
|
||||
scheme_wrong_contract("collect-garbage",
|
||||
"(or/c 'major 'minor)",
|
||||
0, argc, argv);
|
||||
}
|
||||
|
||||
return scheme_void;
|
||||
|
|
Loading…
Reference in New Issue
Block a user