about summary refs log tree commit diff
path: root/src/libstd/rc.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/libstd/rc.rs')
-rw-r--r--src/libstd/rc.rs9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/libstd/rc.rs b/src/libstd/rc.rs
index 51ab885a85f..e0fe75fd907 100644
--- a/src/libstd/rc.rs
+++ b/src/libstd/rc.rs
@@ -32,7 +32,8 @@ use ops::{Deref, Drop};
 use option::{Option, Some, None};
 use ptr;
 use ptr::RawPtr;
-use rt::global_heap::exchange_free;
+use mem::{min_align_of, size_of};
+use rt::heap::exchange_free;
 
 struct RcBox<T> {
     value: T,
@@ -104,7 +105,8 @@ impl<T> Drop for Rc<T> {
                     self.dec_weak();
 
                     if self.weak() == 0 {
-                        exchange_free(self.ptr as *u8)
+                        exchange_free(self.ptr as *mut u8, size_of::<RcBox<T>>(),
+                                      min_align_of::<RcBox<T>>())
                     }
                 }
             }
@@ -177,7 +179,8 @@ impl<T> Drop for Weak<T> {
                 // the weak count starts at 1, and will only go to
                 // zero if all the strong pointers have disappeared.
                 if self.weak() == 0 {
-                    exchange_free(self.ptr as *u8)
+                    exchange_free(self.ptr as *mut u8, size_of::<RcBox<T>>(),
+                                  min_align_of::<RcBox<T>>())
                 }
             }
         }