Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How would one check the system memory available using R on a Windows machine?

Tags:

memory

windows

r

I am running a multi-threaded R program but am having trouble with some nodes crashing due to the host system running out of memory. Is there a way for each node to check the available memory for the entire system before continuing to run? (machine is running Windows Server 2012 R2)

like image 256
jpd527 Avatar asked Jan 05 '15 22:01

jpd527


People also ask

How do I check my Memory in R?

You can force R to perform this check, and free the memory right away, by running the gc() command in R or going to Tools -> Memory -> Free Unused R Memory.

How do I check Memory on Windows?

Press Ctrl + Shift + Esc to launch Task Manager. Or, right-click the Taskbar and select Task Manager. Select the Performance tab and click Memory in the left panel. The Memory window lets you see your current RAM usage, check RAM speed, and view other memory hardware specifications.

How do you check your computer's Memory?

Find Out How Much RAM You Have If you're using a Windows 10 PC, checking your RAM is easy. Open Settings > System > About and look for the Device Specifications section. You should see a line named "Installed RAM"—this will tell you how much you currently have.

What is the command to check Memory utilization in Windows?

It's very easy to check both total RAM and available RAM using the command prompt. Open the command prompt, then enter one of the following commands: To obtain total RAM is: systeminfo | findstr /C:"Total Physical Memory" To check available RAM: systeminfo | find "Available Physical Memory"


1 Answers

Maybe one of the below will help ( I am also on Windows Server 2012 R2):

Maybe this would be the most useful:

> system('systeminfo')
#the output is too big to show but you can save into a list and choose the rows you want

Or just use one of the below which are specific about the memory

> system('wmic MemoryChip get BankLabel, Capacity, MemoryType, TypeDetail, Speed')
BankLabel    Capacity    MemoryType  Speed  TypeDetail  
RAM slot #0  8589934592  2                  512         
RAM slot #1  4294967296  2                  512   

Free available memory:

> system('wmic OS get FreePhysicalMemory /Value')
FreePhysicalMemory=8044340

Total available Memory

> system('wmic OS get TotalVisibleMemorySize /Value')
TotalVisibleMemorySize=12582456

Basically you can even run any other cmd command you want that you know it could help you through the system function. R will show the output on the screen and you can then save into a data.frame and use as you want.

like image 61
LyzandeR Avatar answered Oct 20 '22 21:10

LyzandeR