Hi
i want to learn how can i find the memory usage of my computer.
For example, my ram is 512mb, when i play game, it sometimes fullfilled and my pc shut down otomaticly.I found a program which is called 'RamFree' and i interested in how can i write the program that it will free my ram and help to run games better.
I thought that if find a code which shows %usage of memory,
i can put a infinite loop, and i set a percentage ,for example


Code:
char *p;
while(1)
{
//i may put here a timer( it will make the loop 1 second by 1 second)
while(memory_percentage>0.95)  
{
 // i will allocate some memory here
 calloc  *p   //for example if i need to free %10 i will calculate how many bytes should i write //in calloc function and after i will create my own code

at the end i will free(p) 
}
}
Could you help me please?
i searched the google but always i see the memory allocation topics and etc.
if you have any code about estimating %'ram using',please share with me.