Explorar el Código

Alignment assertions

ticki hace 9 años
padre
commit
537920f98d
Se han modificado 1 ficheros con 3 adiciones y 0 borrados
  1. 3 0
      src/bookkeeper.rs

+ 3 - 0
src/bookkeeper.rs

@@ -207,6 +207,7 @@ impl BlockList {
 
             // Check consistency.
             self.check();
+            debug_assert!(*res as usize % align == 0, "Alignment in `alloc` failed.");
 
             res
         } else {
@@ -272,6 +273,7 @@ impl BlockList {
 
         // Check consistency.
         self.check();
+        debug_assert!(*res.ptr as usize % align == 0, "Alignment in `alloc_fresh` failed.");
 
         res.ptr
     }
@@ -356,6 +358,7 @@ impl BlockList {
 
             // Check consistency.
             self.check();
+            debug_assert!(*ptr as usize % align == 0, "Alignment in `realloc` failed.");
 
             ptr
         }