Skip to content

Commit

Permalink
call collectGarbage after capture
Browse files Browse the repository at this point in the history
  • Loading branch information
mahrud committed Dec 19, 2020
1 parent c75140b commit f3c55e9
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions M2/Macaulay2/m2/examples.m2
Original file line number Diff line number Diff line change
Expand Up @@ -63,11 +63,12 @@ capture String := opts -> s -> if opts.UserMode then capture' s else (
scan(flatten apply(loadedPackages, pkg -> pkg#"exported mutable symbols"), symb -> oldMutableVars#symb = value symb);
-* see run.m2 for details of defaultMode, argumentMode, etc. *-
-- TODO: somehow use SetUlimit, GCMAXHEAP, GCSTATS, GCVERBOSE,
-- ArgInt, ArgNoReadline, ArgNoSetup, and ArgNoThreads
-- ArgInt, ArgQ, ArgNoReadline, ArgNoSetup, and ArgNoThreads
argmode := if 0 < argumentMode & InvertArgs then xor(defaultMode, argumentMode) else argumentMode;
hasmode := m -> argmode & m == m;
pushvar(symbol randomSeed, if hasmode ArgNoRandomize then 0 else randomSeed);
if hasmode ArgStop then (stopIfError, debuggingMode) = (true, false);
-- FIXME: https://github.com/Macaulay2/M2/issues/1536#issuecomment-721826413
-- if hasmode ArgStop then (stopIfError, debuggingMode) = (true, false);
if hasmode ArgNoDebug then debuggingMode = false;
if hasmode ArgNoBacktrace then backtrace = false;
if hasmode ArgNotify then notify = true;
Expand All @@ -88,6 +89,7 @@ capture String := opts -> s -> if opts.UserMode then capture' s else (
currentPackage = User;

ret := capture' s;
collectGarbage();

User#"private dictionary" = oldPrivateDictionary;
-- TODO: this should eventually be unnecessary
Expand Down

0 comments on commit f3c55e9

Please sign in to comment.