about summary refs log tree commit diff
path: root/src/rt/rust_exchange_alloc.cpp
diff options
context:
space:
mode:
authorDaniel Micay <danielmicay@gmail.com>2013-06-29 22:35:04 -0400
committerDaniel Micay <danielmicay@gmail.com>2013-06-30 03:45:36 -0400
commitb883d6a54c460f8357b1107b3599108eb1f8580b (patch)
tree64589d59861624f36771f0f1d1a300fe4d49ffec /src/rt/rust_exchange_alloc.cpp
parent439b13f071a4a884ea8645670df83162ffcf129f (diff)
downloadrust-b883d6a54c460f8357b1107b3599108eb1f8580b.tar.gz
rust-b883d6a54c460f8357b1107b3599108eb1f8580b.zip
simplify the exchange allocator
* stop using an atomic counter, this has a significant cost and
  valgrind will already catch these leaks
* remove the extra layer of function calls
* remove the assert of non-null in free, freeing null is well defined
  but throwing a failure from free will not be
* stop initializing the `prev`/`next` pointers
* abort on out-of-memory, failing won't necessarily work
Diffstat (limited to 'src/rt/rust_exchange_alloc.cpp')
-rw-r--r--src/rt/rust_exchange_alloc.cpp16
1 files changed, 0 insertions, 16 deletions
diff --git a/src/rt/rust_exchange_alloc.cpp b/src/rt/rust_exchange_alloc.cpp
index 89257dc9f6e..658d97031ce 100644
--- a/src/rt/rust_exchange_alloc.cpp
+++ b/src/rt/rust_exchange_alloc.cpp
@@ -15,16 +15,10 @@
 #include <string.h>
 #include <stdio.h>
 
-extern uintptr_t rust_exchange_count;
-uintptr_t rust_exchange_count = 0;
-
 void *
 rust_exchange_alloc::malloc(size_t size) {
   void *value = ::malloc(size);
   assert(value);
-
-  sync::increment(rust_exchange_count);
-
   return value;
 }
 
@@ -37,15 +31,5 @@ rust_exchange_alloc::realloc(void *ptr, size_t size) {
 
 void
 rust_exchange_alloc::free(void *ptr) {
-  sync::decrement(rust_exchange_count);
   ::free(ptr);
 }
-
-void
-rust_check_exchange_count_on_exit() {
-  if (rust_exchange_count != 0) {
-    printf("exchange heap not empty on exit\n");
-    printf("%d dangling allocations\n", (int)rust_exchange_count);
-    abort();
-  }
-}