Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8176735
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T23:18:48+00:00 2026-06-06T23:18:48+00:00

I have a Java service that currently runs with a 14GB heap. I am

  • 0

I have a Java service that currently runs with a 14GB heap. I am keen to try out the -XX:+UseLargePages option to see how this might affect the performance of the system. I have configured the OS as described by Oracle using appropriate shared memory and page values (these can also be calculated with an online tool).

Once the OS is configured, I can see that it allocates the expected amount of memory as huge-pages. However, starting the VM with the -XX:+UseLargePages option set always results in one of the following errors:

When -Xms / -Xmx is almost equal to the huge page allocation:

    Failed to reserve shared memory (errno = 28). // 'No space left on device'

When -Xms / -Xmx is less than the huge page allocation:

    Failed to reserve shared memory (errno = 12). // 'Out of memory'

I did try introducing some leeway – so on a 32GB system I allocated 24GB of shared memory and hugepages to use with a JVM configured with a 20GB heap, of which only 14GB is currently utilized. I also verified that the user executing the JVM did have group rights consistent with /proc/sys/vm/hugetlb_shm_group.

Can anyone give me some pointers on where I might be going wrong and what I could try next?

Allocations/utilization:

  • -Xms / -Xmx – 20GB
  • Utilized heap – 14GB
  • /proc/sys/kernel/shmmax – 25769803776 (24GB)
  • /proc/sys/vm/nr_hugepages – 12288

Environment:

  • System memory – 32GB
  • System page size – 2048KB
  • debian 2.6.26-2-amd64
  • Sun JVM 1.6.0_20-b02

Solution

Thanks to @jfgagne for providing an answer that lead to a solution. In addition to the /proc/sys/kernel/shmall setting (specified as 4KB pages), I had to add entries to /etc/security/limits.conf as described on Thomas’ blog. However, as my application is started using jsvc I also had to duplicate the settings for the root user (note that the limits are specified in KB):

    root       soft memlock 25165824
    root       hard memlock 25165824
    pellegrino soft memlock 25165824
    pellegrino hard memlock 25165824

It’s also worth mentioning that settings could be tested quickly by starting the JVM with the -version argument:

    java -XX:+UseLargePages -Xmx20g -version
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T23:18:50+00:00Added an answer on June 6, 2026 at 11:18 pm

    When you use huge pages with Java, there is not only the heap using huge pages, but there is also the PermGen: do not forget to allocate space for it. It seems this is why you have a different errno message when you set Xmx near the amount of huge pages.

    There is also the shmall kernel parameter that needs to be set which you did not mention, maybe it is what is blocking you. In your case, you should set it to 6291456.

    The last thing to say: when using huge pages, the Xms parameter is not used anymore: Java reserves all Xmx in shared memory using huge pages.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a Java web-service which currently runs on a local tomcat server. I
We currently have a java/jsp online web service that includes it's own custom calendar.
I have a server written in Java that runs as a Windows service (thanks
We have a Java web service that we call from our application. When we
I have a Java application that run as a background service, i.e. no GUI.
I have created a Java web service and I am trying to access this
I have developed a Java aplication that is currently being run by double-clicking on
I am working on a java web service that is currently connected to a
I'm trying to learn annotations. I currently have a webapp that runs an init()
I am running a web service that currently sends confirmation emails out to new

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.