Update memory pool size calculation

This commit is contained in:
a2x 2024-04-10 10:52:56 +10:00
parent 1059075dda
commit 9b8bd68308
2 changed files with 4 additions and 4 deletions

View File

@ -5,7 +5,6 @@ pub enum MemoryPoolGrowType {
None = 0, None = 0,
Fast, Fast,
Slow, Slow,
RbTree,
} }
#[derive(Pod)] #[derive(Pod)]
@ -36,13 +35,14 @@ pub struct UtlMemoryPoolBase {
pub free_list_head: Pointer64<FreeList>, // 0x0020 pub free_list_head: Pointer64<FreeList>, // 0x0020
pad_0028: [u8; 0x44], // 0x0028 pad_0028: [u8; 0x44], // 0x0028
pub blob_head: Pointer64<Blob>, // 0x0070 pub blob_head: Pointer64<Blob>, // 0x0070
pad_0078: [u8; 0x8], // 0x0078 pub total_size: i32, // 0x0078
pad_007c: [u8; 0x4], // 0x007C
} }
impl UtlMemoryPoolBase { impl UtlMemoryPoolBase {
/// Returns the total size of the memory pool. /// Returns the total size of the memory pool.
#[inline] #[inline]
pub fn size(&self) -> i32 { pub fn size(&self) -> i32 {
(self.num_blobs as i32 * self.blocks_per_blob) * self.block_size self.total_size
} }
} }

View File

@ -62,7 +62,7 @@ where
self.entry_mem.peak_alloc self.entry_mem.peak_alloc
} }
// TODO: /// Returns a list of allocated or unallocated elements.
pub fn elements(&self, process: &mut IntoProcessInstanceArcBox<'_>) -> Result<Vec<D>> { pub fn elements(&self, process: &mut IntoProcessInstanceArcBox<'_>) -> Result<Vec<D>> {
let blocks_alloc = self.blocks_alloc() as usize; let blocks_alloc = self.blocks_alloc() as usize;
let peak_alloc = self.peak_count() as usize; let peak_alloc = self.peak_count() as usize;