在Windows计算机上使用R如何检查可用的系统内存? [英] How would one check the system memory available using R on a Windows machine?

查看:308
本文介绍了在Windows计算机上使用R如何检查可用的系统内存?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在运行一个多线程R程序,但是由于主机系统内存不足而导致某些节点崩溃的问题.每个节点是否有办法在继续运行之前检查整个系统的可用内存? (计算机正在运行Windows Server 2012 R2)

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)

推荐答案

以下内容之一可能会有所帮助(我也在Windows Server 2012 R2上):

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

也许这将是最有用的:

> 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   

可用内存:

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

总可用内存

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

基本上,您甚至可以运行任何其他希望通过system函数帮助您的cmd命令. R将在屏幕上显示输出,然后您可以将其保存到data.frame中并根据需要使用.

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.

这篇关于在Windows计算机上使用R如何检查可用的系统内存?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆