Skip to content

Commit

Permalink
Clean-up the GC.gc interface. (#34401)
Browse files Browse the repository at this point in the history
(cherry picked from commit 270fcff)
  • Loading branch information
maleadt authored and KristofferC committed Jan 21, 2020
1 parent 7ef6328 commit 8683bfc
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions base/gcutils.jl
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,13 @@ Module with garbage collection utilities.
"""
module GC

# mirrored from julia.h
const GC_AUTO = 0
const GC_FULL = 1
const GC_INCREMENTAL = 2

"""
GC.gc()
GC.gc(full::Bool)
GC.gc([full=true])
Perform garbage collection. The argument `full` determines the kind of
collection: A full collection (default) sweeps all objects, which makes the
Expand All @@ -61,8 +65,8 @@ so-called young objects.
!!! warning
Excessive use will likely lead to poor performance.
"""
gc() = ccall(:jl_gc_collect, Cvoid, (Cint,), 1)
gc(full::Bool) = ccall(:jl_gc_collect, Cvoid, (Cint,), full ? 1 : 2)
gc(full::Bool=true) =
ccall(:jl_gc_collect, Cvoid, (Cint,), full ? GC_FULL : GC_INCREMENTAL)

"""
GC.enable(on::Bool)
Expand Down

0 comments on commit 8683bfc

Please sign in to comment.