void memoryRelease(void) { MEMDestroyExpHeap(mem1_heap); MEMFreeToFrmHeap(MEMGetBaseHeapHandle(MEM_BASE_HEAP_MEM1), MEM_FRAME_HEAP_FREE_ALL); mem1_heap = NULL; MEMDestroyExpHeap(bucket_heap); MEMFreeToFrmHeap(MEMGetBaseHeapHandle(MEM_BASE_HEAP_FG), MEM_FRAME_HEAP_FREE_ALL); bucket_heap = NULL; }
void memoryRelease(void) { MEMDestroyExpHeap(mem1_heap); MEMFreeToFrmHeap(MEMGetBaseHeapHandle(MEMORY_ARENA_1), 3); mem1_heap = NULL; MEMDestroyExpHeap(bucket_heap); MEMFreeToFrmHeap(MEMGetBaseHeapHandle(MEMORY_ARENA_FG_BUCKET), 3); bucket_heap = NULL; }
// TODO: Move to coreinit::internal void CoreFreeDefaultHeap() { // Delete all base heaps for (auto i = 0u; i < MEMBaseHeapType::Max; ++i) { if (sMemArenas[i]) { auto heap = reinterpret_cast<CommonHeap*>(sMemArenas[i]); switch (heap->tag) { case MEMiHeapTag::ExpandedHeap: MEMDestroyExpHeap(reinterpret_cast<ExpandedHeap*>(heap)); break; case MEMiHeapTag::FrameHeap: MEMDestroyFrmHeap(reinterpret_cast<FrameHeap*>(heap)); break; case MEMiHeapTag::UnitHeap: case MEMiHeapTag::UserHeap: case MEMiHeapTag::BlockHeap: default: assert(false); } sMemArenas[i] = nullptr; } } }
// TODO: Move to coreinit::internal void CoreFreeDefaultHeap() { // Delete all base heaps for (auto i = 0u; i < MEMBaseHeapType::Max; ++i) { if (sMemArenas[i]) { auto heap = reinterpret_cast<CommonHeap*>(sMemArenas[i]); switch (heap->tag) { case MEMiHeapTag::ExpandedHeap: MEMDestroyExpHeap(reinterpret_cast<ExpandedHeap*>(heap)); break; case MEMiHeapTag::FrameHeap: MEMDestroyFrmHeap(reinterpret_cast<FrameHeap*>(heap)); break; case MEMiHeapTag::UnitHeap: case MEMiHeapTag::UserHeap: case MEMiHeapTag::BlockHeap: default: assert(false); } sMemArenas[i] = nullptr; } } // Delete system heap MEMDestroyExpHeap(sSystemHeap); sSystemHeap = nullptr; // Free function pointers if (pMEMAllocFromDefaultHeap) { coreinit::internal::sysFree(pMEMAllocFromDefaultHeap); pMEMAllocFromDefaultHeap = nullptr; } if (pMEMAllocFromDefaultHeapEx) { coreinit::internal::sysFree(pMEMAllocFromDefaultHeap); pMEMAllocFromDefaultHeap = nullptr; } if (pMEMFreeToDefaultHeap) { coreinit::internal::sysFree(pMEMAllocFromDefaultHeap); pMEMAllocFromDefaultHeap = nullptr; } }
void CoreFreeDefaultHeap() { // Delete all base heaps for (auto i = 0u; i < static_cast<size_t>(BaseHeapType::Max); ++i) { if (gMemArenas[i]) { auto heap = reinterpret_cast<CommonHeap*>(gMemArenas[i]); switch (heap->tag) { case HeapType::ExpandedHeap: MEMDestroyExpHeap(reinterpret_cast<ExpandedHeap*>(heap)); break; case HeapType::FrameHeap: MEMDestroyFrmHeap(reinterpret_cast<FrameHeap*>(heap)); break; case HeapType::UnitHeap: case HeapType::UserHeap: case HeapType::BlockHeap: default: assert(false); } gMemArenas[i] = nullptr; } } // Delete system heap MEMDestroyExpHeap(gSystemHeap); gSystemHeap = nullptr; // Free function pointers if (pMEMAllocFromDefaultHeap) { OSFreeToSystem(pMEMAllocFromDefaultHeap); pMEMAllocFromDefaultHeap = nullptr; } if (pMEMAllocFromDefaultHeapEx) { OSFreeToSystem(pMEMAllocFromDefaultHeap); pMEMAllocFromDefaultHeap = nullptr; } if (pMEMFreeToDefaultHeap) { OSFreeToSystem(pMEMAllocFromDefaultHeap); pMEMAllocFromDefaultHeap = nullptr; } }