about summary refs log tree commit diff
path: root/src/rt/memory_region.cpp
diff options
context:
space:
mode:
authorBrian Anderson <banderson@mozilla.com>2011-07-19 23:33:37 -0700
committerBrian Anderson <banderson@mozilla.com>2011-07-20 10:22:18 -0700
commita467e8e4e6981208b0de4e5fb44885f12c390412 (patch)
tree70b5bf413a38f3c79d1528e5aba9f38c82b4c339 /src/rt/memory_region.cpp
parent3fb33008ce5bdd1e369b471bc20b6fe28c0f550e (diff)
downloadrust-a467e8e4e6981208b0de4e5fb44885f12c390412.tar.gz
rust-a467e8e4e6981208b0de4e5fb44885f12c390412.zip
Add a huge hack to allow the test runner to continue if a single task leaks
This is just until unwinding works. Adds a flag to the runtime to turn
the memory leak checks on task destruction into warnings instead of fatal
errors. I am so sorry.

Issue #428
Diffstat (limited to 'src/rt/memory_region.cpp')
-rw-r--r--src/rt/memory_region.cpp13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/rt/memory_region.cpp b/src/rt/memory_region.cpp
index 13de56a3361..0d10146a52b 100644
--- a/src/rt/memory_region.cpp
+++ b/src/rt/memory_region.cpp
@@ -152,10 +152,21 @@ memory_region::~memory_region() {
         }
     }
 #endif
-    _srv->fatal(msg, __FILE__, __LINE__, "%d objects", _live_allocations);
+    if (!_hack_allow_leaks) {
+        _srv->fatal(msg, __FILE__, __LINE__,
+                    "%d objects", _live_allocations);
+    } else {
+        _srv->warning(msg, __FILE__, __LINE__,
+                      "%d objects", _live_allocations);
+    }
     if (_synchronized) { _lock.unlock(); }
 }
 
+void
+memory_region::hack_allow_leaks() {
+    _hack_allow_leaks = true;
+}
+
 //
 // Local Variables:
 // mode: C++