我想知道如何调和以下错误?
JVM无法使用大页面内存,因为它没有足够的权限来锁定内存中的页面
设置是:
设置JAVA_OPTS = -Xms20g -Xmx20g -XX:+ UseConcMarkSweepGC -XX:+ UseParNewGC -XX:+ UseLargePages -Duser.timezone ="GMT"%DEBUG%
这发生在Windows Server 2003上.
谷歌搜索错误导致openjdk-6中的hotspot/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.
Run Code Online (Sandbox Code Playgroud)
如果您使用的是Windows 2003,这可能会有所帮助.如果没有,我没有任何其他建议.
仅 Windows Server 2003 支持大页内存。为了使用它,管理员必须首先为将运行该应用程序的用户分配额外的权限: 1. 选择控制面板 -> 管理工具 -> 本地安全策略 2. 选择本地策略 -> 用户权限分配 3. 双单击“锁定内存中的页面”,添加用户和/或组 4. 重新启动计算机