添加链接
link之家
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接
Collectives™ on Stack Overflow

Find centralized, trusted content and collaborate around the technologies you use most.

Learn more about Collectives

Teams

Q&A for work

Connect and share knowledge within a single location that is structured and easy to search.

Learn more about Teams

JVM cannot use large page memory because it does not have enough privilege to lock pages in memory

Ask Question

JVM cannot use large page memory because it does not have enough privilege to lock pages in memory

The settings are:

set JAVA_OPTS=-Xms20g -Xmx20g -XX:+UseConcMarkSweepGC -XX:+UseParNewGC -XX:+UseLargePages -Duser.timezone="GMT" %DEBUG%

This happened on Windows Server 2003.

Googling on the error leads to the hotspot/src/os/win32/vm/os_win32.cpp source file in openjdk-6 wich contains the following comment:

// 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.

If you're using Windows 2003, this might help. If not, I don't have any other suggestion.

learn.microsoft.com/en-us/sql/database-engine/configure-windows/… - Applies to Windows Server 2016 and Windows 10 (uses gpedit.msc) – Thomas Taylor Feb 25, 2021 at 14:33

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.

    The program who will call the java interpreter (java program.java) must be called with administrative rulles. Example: Eclipse, Netbeans, cmd, etc. In Windows made after 2003, you need do settings above, and after you can click with right button to open menu and choose "run as admnistrator" on the icon or executable caller program.

    Only Windows Server 2003 supports large page memory. In order to use it, the administrator must first assign additional privilege to the user who will be running the application: 1. select Control Panel -> Administrative Tools -> Local Security Policy 2. select Local Policies -> User Rights Assignment 3. double click "Lock pages in memory", add users and/or groups 4. reboot the machine

    java.sun.com/javase/technologies/hotspot/largememory.jsp Only Windows Server 2003 supports that among the windows family. Solaris and Linux support them too. – Vinko Vrsalovic Oct 23, 2009 at 20:41 how does Large Memory benefit a jvm? why is it important to lock a process into physical memory? – djangofan Nov 17, 2009 at 18:55

    Thanks for contributing an answer to Stack Overflow!

    • Please be sure to answer the question. Provide details and share your research!

    But avoid

    • Asking for help, clarification, or responding to other answers.
    • Making statements based on opinion; back them up with references or personal experience.

    To learn more, see our tips on writing great answers.