@@ -49,29 +49,20 @@ Module with garbage collection utilities.
49
49
"""
50
50
module GC
51
51
52
- # @enum-like structure
53
- struct CollectionType
54
- x:: Int
55
- end
56
- Base. cconvert (:: Type{Cint} , collection:: CollectionType ) = Cint (collection. x)
57
-
58
- const Auto = CollectionType (0 )
59
- const Full = CollectionType (1 )
60
- const Incremental = CollectionType (2 )
61
-
62
52
"""
63
- GC.gc(full::Bool=true )
64
- GC.gc(collection::CollectionType )
53
+ GC.gc()
54
+ GC.gc(full::Bool )
65
55
66
- Perform garbage collection. The argument `full` determines whether a full, but more costly
67
- collection is performed. Otherwise, heuristics are used to determine which type of
68
- collection is needed. For exact control, pass an argument of type `CollectionType`.
56
+ Perform garbage collection. The argument `full` determines the kind of collection: A full
57
+ collection scans all objects, while an incremental collection only scans so-called young
58
+ objects and is much quicker. If called without an argument, heuristics are used to determine
59
+ which type of collection is needed.
69
60
70
61
!!! warning
71
62
Excessive use will likely lead to poor performance.
72
63
"""
73
- gc (full :: Bool = true ) = ccall (:jl_gc_collect , Cvoid, (Cint,), full )
74
- gc (collection :: CollectionType ) = ccall (:jl_gc_collect , Cvoid, (Cint,), collection )
64
+ gc () = ccall (:jl_gc_collect , Cvoid, (Cint,), 0 )
65
+ gc (full :: Bool ) = ccall (:jl_gc_collect , Cvoid, (Cint,), full ? 1 : 2 )
75
66
76
67
"""
77
68
GC.enable(on::Bool)
0 commit comments