From b16cc0294e517bbf648261c6e298e01362db9ab0 Mon Sep 17 00:00:00 2001 From: "Kartik K. Agaram" Date: Fri, 14 Apr 2017 10:05:54 -0700 Subject: 3822 Provide an option to disable memory reclamation. This makes edit/ *much* more responsive. The cost: memory use grows monotonically. Since we no longer have a safe way to reclaim heap allocations, we never do so. --- 036refcount.cc | 8 ++++++++ 043space.cc | 1 + 2 files changed, 9 insertions(+) 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& 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); -- cgit 1.4.1-2-gfad0