Skip to content

Commit f4c4a88

Browse files
committed
save gc change
1 parent bbfa3f6 commit f4c4a88

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/ProbProg.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -699,8 +699,6 @@ end
699699
function generate(
700700
f::Function, args::Vararg{Any,Nargs}; constraint::Constraint=Dict{Symbol,Any}()
701701
) where {Nargs}
702-
old_gc_state = GC.enable(false)
703-
704702
trace = nothing
705703
weight = nothing
706704
res = nothing
@@ -712,8 +710,10 @@ function generate(
712710
return generate_internal(f, args...; constraint_ptr, constrained_symbols)
713711
end
714712

713+
compiled_fn = @compile optimize = :probprog wrapper_fn(constraint_ptr, args...)
714+
715+
old_gc_state = GC.enable(false)
715716
try
716-
compiled_fn = @compile optimize = :probprog wrapper_fn(constraint_ptr, args...)
717717
trace, weight, res = compiled_fn(constraint_ptr, args...)
718718
finally
719719
GC.enable(old_gc_state)

0 commit comments

Comments
 (0)