forked from koniifer/ableos
Zero memory on allocation
This commit is contained in:
parent
ada43910d2
commit
ebfc9c1c4e
|
@ -150,7 +150,8 @@ impl Heap {
|
||||||
#[cfg(debug_assertions)]
|
#[cfg(debug_assertions)]
|
||||||
trace!("Allocating {:?}", ptr);
|
trace!("Allocating {:?}", ptr);
|
||||||
}
|
}
|
||||||
// FIXME: zero out memory to prevent leaking data
|
|
||||||
|
unsafe { core::ptr::write_bytes(ptr, 0, size) };
|
||||||
|
|
||||||
assert!(ptr.is_aligned_to(alignment));
|
assert!(ptr.is_aligned_to(alignment));
|
||||||
NonNull::new(ptr)
|
NonNull::new(ptr)
|
||||||
|
@ -168,6 +169,7 @@ impl Heap {
|
||||||
self.bitmap_set_range(start, size, false);
|
self.bitmap_set_range(start, size, false);
|
||||||
self.allocated_chunks -= size;
|
self.allocated_chunks -= size;
|
||||||
// FIXME: zero out memory to prevent leaking data
|
// FIXME: zero out memory to prevent leaking data
|
||||||
|
// REPLY: When we zero on alloc, do we really need it?
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Finds first hole that can fit an allocation of `size` chunks, returns the start of the
|
/// Finds first hole that can fit an allocation of `size` chunks, returns the start of the
|
||||||
|
|
Loading…
Reference in a new issue