mirror of
https://github.com/wiiu-env/MemoryMappingModule.git
synced 2024-11-25 11:16:53 +01:00
Add a function to get the total free space left on the heaps
This commit is contained in:
parent
3a0abb940f
commit
5ac51ef3ce
@ -20,11 +20,14 @@ WUMS_INITIALIZE(){
|
|||||||
|
|
||||||
MemoryMapping::setupMemoryMapping();
|
MemoryMapping::setupMemoryMapping();
|
||||||
MemoryMapping::CreateHeaps();
|
MemoryMapping::CreateHeaps();
|
||||||
|
DEBUG_FUNCTION_LINE("total free space %d KiB", MemoryMapping::GetFreeSpace()/1024);
|
||||||
}
|
}
|
||||||
|
|
||||||
int main(int argc, char **argv) {
|
int main(int argc, char **argv) {
|
||||||
|
WHBLogUdpInit();
|
||||||
MemoryMapping::DestroyHeaps();
|
MemoryMapping::DestroyHeaps();
|
||||||
MemoryMapping::CreateHeaps();
|
MemoryMapping::CreateHeaps();
|
||||||
|
DEBUG_FUNCTION_LINE("total free space %d KiB", MemoryMapping::GetFreeSpace()/1024);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -389,6 +389,19 @@ void MemoryMapping::free(void* ptr){
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
uint32_t MemoryMapping::GetFreeSpace() {
|
||||||
|
uint32_t res = 0;
|
||||||
|
for(int32_t i = 0; /* waiting for a break */; i++) {
|
||||||
|
if(mem_mapping[i].physical_addresses == NULL) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
uint32_t curRes = MEMGetTotalFreeSizeForExpHeap((MEMHeapHandle) mem_mapping[i].effective_start_address);
|
||||||
|
DEBUG_FUNCTION_LINE("heap at %08X MEMGetTotalFreeSizeForExpHeap: %d KiB",mem_mapping[i].effective_start_address, curRes/1024 );
|
||||||
|
res+=curRes;
|
||||||
|
}
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
void MemoryMapping::CreateHeaps() {
|
void MemoryMapping::CreateHeaps() {
|
||||||
for (int32_t i = 0; /* waiting for a break */; i++) {
|
for (int32_t i = 0; /* waiting for a break */; i++) {
|
||||||
if (mem_mapping[i].physical_addresses == NULL) {
|
if (mem_mapping[i].physical_addresses == NULL) {
|
||||||
|
@ -165,6 +165,8 @@ public:
|
|||||||
|
|
||||||
static void setupMemoryMapping();
|
static void setupMemoryMapping();
|
||||||
|
|
||||||
|
static uint32_t GetFreeSpace();
|
||||||
|
|
||||||
static void CreateHeaps();
|
static void CreateHeaps();
|
||||||
|
|
||||||
static void DestroyHeaps();
|
static void DestroyHeaps();
|
||||||
|
Loading…
Reference in New Issue
Block a user