mirror of
https://github.com/italicsjenga/agb.git
synced 2024-12-23 08:11:33 +11:00
remove block counting to no longer attempt to detect memory leaks
remove checking blocks Signed-off-by: Corwin <corwin@kuiper.dev>
This commit is contained in:
parent
844f3b29d3
commit
90be23a192
|
@ -71,12 +71,6 @@ impl BlockAllocator {
|
|||
f(inner)
|
||||
}
|
||||
|
||||
#[doc(hidden)]
|
||||
#[cfg(any(test, feature = "testing"))]
|
||||
pub unsafe fn number_of_blocks(&self) -> u32 {
|
||||
self.with_inner(|inner| inner.number_of_blocks())
|
||||
}
|
||||
|
||||
pub unsafe fn alloc(&self, layout: Layout) -> Option<NonNull<u8>> {
|
||||
self.with_inner(|inner| inner.alloc(layout))
|
||||
}
|
||||
|
@ -105,20 +99,6 @@ impl BlockAllocatorInner {
|
|||
}
|
||||
}
|
||||
|
||||
#[doc(hidden)]
|
||||
#[cfg(any(test, feature = "testing"))]
|
||||
pub unsafe fn number_of_blocks(&mut self) -> u32 {
|
||||
let mut count = 0;
|
||||
|
||||
let mut list_ptr = &mut self.state.first_free_block;
|
||||
while let Some(mut current) = list_ptr {
|
||||
count += 1;
|
||||
list_ptr = &mut current.as_mut().next;
|
||||
}
|
||||
|
||||
count
|
||||
}
|
||||
|
||||
/// Requests a brand new block from the inner bump allocator
|
||||
fn new_block(&mut self, layout: Layout) -> Option<NonNull<u8>> {
|
||||
let overall_layout = Block::either_layout(layout);
|
||||
|
|
|
@ -119,11 +119,6 @@ static __IWRAM_ALLOC: BlockAllocator = unsafe {
|
|||
})
|
||||
};
|
||||
|
||||
#[cfg(any(test, feature = "testing"))]
|
||||
pub(crate) unsafe fn number_of_blocks() -> u32 {
|
||||
GLOBAL_ALLOC.number_of_blocks()
|
||||
}
|
||||
|
||||
fn iwram_data_end() -> usize {
|
||||
extern "C" {
|
||||
static __iwram_end: u8;
|
||||
|
|
|
@ -306,12 +306,6 @@ pub mod test_runner {
|
|||
self(gba);
|
||||
mgba::test_runner_measure_cycles();
|
||||
|
||||
assert!(
|
||||
unsafe { agb_alloc::number_of_blocks() } < 2,
|
||||
"memory is being leaked, there are {} blocks",
|
||||
unsafe { agb_alloc::number_of_blocks() }
|
||||
);
|
||||
|
||||
mgba.print(format_args!("[ok]"), mgba::DebugLevel::Info)
|
||||
.unwrap();
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue