diff options
-rw-r--r-- | 036refcount.cc | 8 | ||||
-rw-r--r-- | 043space.cc | 1 |
2 files changed, 9 insertions, 0 deletions
diff --git a/036refcount.cc b/036refcount.cc index 8297c4ed..f90d6e3f 100644 --- a/036refcount.cc +++ b/036refcount.cc @@ -20,8 +20,16 @@ def main [ :(before "End write_memory(x) Special-cases") update_any_refcounts(x, data); +:(before "End Globals") +bool Reclaim_memory = true; +:(before "End Commandline Options(*arg)") +else if (is_equal(*arg, "--no-reclaim")) { + cerr << "Disabling memory reclamation. Some tests will fail.\n"; + Reclaim_memory = false; +} :(code) void update_any_refcounts(const reagent& canonized_x, const vector<double>& data) { + if (!Reclaim_memory) return; if (!should_update_refcounts()) return; increment_any_refcounts(canonized_x, data); // increment first so we don't reclaim on x <- copy x decrement_any_refcounts(canonized_x); diff --git a/043space.cc b/043space.cc index 1562c11f..770871c1 100644 --- a/043space.cc +++ b/043space.cc @@ -230,6 +230,7 @@ try_reclaim_locals(); :(code) void try_reclaim_locals() { + if (!Reclaim_memory) return; // only reclaim routines starting with 'local-scope' const recipe_ordinal r = get(Recipe_ordinal, current_recipe_name()); const recipe& exiting_recipe = get(Recipe, r); |