JVM 无法使用大页内存,因为它没有足够的权限来锁定内存中的页面

StackOverflow https://stackoverflow.com/questions/1615717

  •  06-07-2019
  •  | 
  •  

我想知道如何解决以下错误?

JVM无法使用大型内存,因为它没有足够的特权将页面锁定在内存中

设置为:

设置java_opts = -xms20g -xmx20g -xx:+useconcmarkSweepgc -xx:+useparnewgc -xx:+uselargepages -duser.timezone.timezone =“ gmt”%debug%

这发生在 Windows Server 2003 上。

有帮助吗?

解决方案 3

只有Windows Server 2003支持大页面内存。要使用它,管理员必须首先为将运行该应用程序的用户分配其他权限: 1.选择控制面板 - >管理工具 - >本地安全政策 2.选择本地政策 - >用户权利分配 3.双击“锁定内存中的页面”,添加用户和/或组 4.重启机器

其他提示

搜索错误会导致 hotspot / openjdk-6中的src / os / win32 / vm / os_win32.cpp 源文件包含以下注释:

// Windows large page support is available on Windows 2003. In order to use
// large page memory, the administrator must first assign additional privilege
// to the user:
//   + select Control Panel -> Administrative Tools -> Local Security Policy
//   + select Local Policies -> User Rights Assignment
//   + double click "Lock pages in memory", add users and/or groups
//   + reboot
// Note the above steps are needed for administrator as well, as administrators
// by default do not have the privilege to lock pages in memory.
//
// Note about Windows 2003: although the API supports committing large page
// memory on a page-by-page basis and VirtualAlloc() returns success under this
// scenario, I found through experiment it only uses large page if the entire
// memory region is reserved and committed in a single VirtualAlloc() call.
// This makes Windows large page support more or less like Solaris ISM, in
// that the entire heap must be committed upfront. This probably will change
// in the future, if so the code below needs to be revisited.

如果您使用的是Windows 2003,这可能有所帮助。如果没有,我没有任何其他建议。

我发现仅设置以下配置是不够的:

Windows 2003 提供 Windows 大页面支持。为了使用
大页内存,管理员必须首先分配额外的权限
致用户:

  • 选择控制面板 -> 管理工具 -> 本地安全策略
  • 选择本地策略 -> 用户权限分配
  • 双击“锁定内存中的页面”,添加用户和/或组
  • 重启

请注意,管理员也需要执行上述步骤,作为管理员
默认情况下没有权限锁定内存中的页面。

将调用java解释器的程序(java 程序.java) 必须按照管理规则调用。例子:Eclipse、Netbeans、cmd 等在2003年以后的Windows中,需要进行上述设置,然后可以点击右键打开菜单并选择 “以管理员身份运行” 在图标或可执行调用程序上。

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top