[common] Heap Tracker
All checks were successful
eden-license / license-header (pull_request) Successful in 22s
All checks were successful
eden-license / license-header (pull_request) Successful in 22s
Pulled from PR 398 originally authored by Gamer64 and pulled from commit by Jarrod Norwell. Changes the heap tracker so things get destroyed so they aren't continually allocated without being removed.
This commit is contained in:
parent
954c17c18a
commit
24d0ec61e6
1 changed files with 14 additions and 16 deletions
|
@ -46,14 +46,13 @@ void HeapTracker::Map(size_t virtual_offset, size_t host_offset, size_t length,
|
||||||
// We are mapping part of a separate heap.
|
// We are mapping part of a separate heap.
|
||||||
std::scoped_lock lk{m_lock};
|
std::scoped_lock lk{m_lock};
|
||||||
|
|
||||||
auto* const map = new SeparateHeapMap{
|
std::unique_ptr<SeparateHeapMap> map;
|
||||||
.vaddr = virtual_offset,
|
map->vaddr = virtual_offset;
|
||||||
.paddr = host_offset,
|
map->paddr = host_offset;
|
||||||
.size = length,
|
map->size = length;
|
||||||
.tick = m_tick++,
|
map->tick = m_tick++;
|
||||||
.perm = perm,
|
map->perm = perm;
|
||||||
.is_resident = false,
|
map->is_resident = false;
|
||||||
};
|
|
||||||
|
|
||||||
// Insert into mappings.
|
// Insert into mappings.
|
||||||
m_map_count++;
|
m_map_count++;
|
||||||
|
@ -251,14 +250,13 @@ void HeapTracker::SplitHeapMapLocked(VAddr offset) {
|
||||||
left->size = left_size;
|
left->size = left_size;
|
||||||
|
|
||||||
// Create the new right map.
|
// Create the new right map.
|
||||||
auto* const right = new SeparateHeapMap{
|
std::unique_ptr<SeparateHeapMap> right;
|
||||||
.vaddr = left->vaddr + left_size,
|
right->vaddr = left->vaddr + left_size;
|
||||||
.paddr = left->paddr + left_size,
|
right->paddr = left->paddr + left_size;
|
||||||
.size = orig_size - left_size,
|
right->size = orig_size - left_size;
|
||||||
.tick = left->tick,
|
right->tick = left->tick;
|
||||||
.perm = left->perm,
|
right->perm = left->perm;
|
||||||
.is_resident = left->is_resident,
|
right->is_resident = left->is_resident;
|
||||||
};
|
|
||||||
|
|
||||||
// Insert the new right map.
|
// Insert the new right map.
|
||||||
m_map_count++;
|
m_map_count++;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue