How find out free RAM? #2052
Unanswered
TiM-SyStEm
asked this question in
Q&A
Replies: 1 comment 1 reply
-
You have to make a memory monitor that will calculate the free memory. class KernelMemoryMonitor
{
public static uint GetUsedMemory()
{
uint UsedRAM = CPU.GetEndOfKernel() + 1024;
return UsedRAM / div;
}
public static uint TotalMemory = CPU.GetAmountOfRAM();
public uint FreePercentage;
public uint UsedPercentage = (GetUsedMemory() * 100) / TotalMemory;
public uint FreeMemory = TotalMemory - GetUsedMemory();
private const uint div = 1048576;
public static void GetTotalMemory()
{
TotalMemory = CPU.GetAmountOfRAM() + 1;
}
public void Monitor()
{
GetTotalMemory();
FreeMemory = TotalMemory - GetUsedMemory();
UsedPercentage = (GetUsedMemory() * 100) / TotalMemory;
FreePercentage = 100 - UsedPercentage;
}
public KernelMemoryMonitor()
{
this.Monitor();
}
public static uint GetFreeMemory()
{
return TotalMemory - GetUsedMemory();
}
} |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Everything I found, method
Cosmos.Core.CPU.GetAmountOfRAM()
but that's not itBeta Was this translation helpful? Give feedback.
All reactions