You are not logged in.

#1 2014-01-28 04:39:28

smeghead
Member
Registered: 2014-01-22
Posts: 7

What is limiting memory that Java can use? [closed]

I have just installed from scratch on a new 64-bit machine and have noticed that something is stopping Java (jdk7-openjdk) from grabbing its default heap space:

>java -version
Error occurred during initialization of VM
Could not reserve enough space for object heap
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.

I bit of binary chopping and I have discovered that 882M seems to be the maximum usable heap:

>java -Xmx882M -version
java version "1.7.0_51"
OpenJDK Runtime Environment (IcedTea 2.4.4) (ArchLinux build 7.u51_2.4.4-1-x86_64)
OpenJDK 64-Bit Server VM (build 24.45-b08, mixed mode)

>java -Xmx883M -version
#
# There is insufficient memory for the Java Runtime Environment to continue.
# pthread_getattr_np
# An error report file with more information is saved as:
# /tmp/hs_err_pid30550.log
java version "1.7.0_51"
OpenJDK Runtime Environment (IcedTea 2.4.4) (ArchLinux build 7.u51_2.4.4-1-x86_64)
OpenJDK 64-Bit Server VM (build 24.45-b08, mixed mode)

This computer has 8GB of RAM with an 8GB swap file, and currently just under 1GB is in use.

I have also tried this with Oracle JDK and the limit there was 972M.

These numbers are on the low side.  What is limiting the amount of memory that the Java can grab?  I have looked into ulimit and systemd-cgroups and neither seem to be limiting memory.  I definitely haven't  consciously done anything to limit maximum memory per process.

What else could be limiting Java?

Last edited by smeghead (2014-01-28 05:42:44)

Offline

#2 2014-01-28 04:46:22

smeghead
Member
Registered: 2014-01-22
Posts: 7

Re: What is limiting memory that Java can use? [closed]

I should add that the numbers stay the same even after a reboot, so there does seem to be some kind of hard limit in play here.

Offline

#3 2014-01-28 05:41:36

smeghead
Member
Registered: 2014-01-22
Posts: 7

Re: What is limiting memory that Java can use? [closed]

It was ulimit all along.  If you run it with no parameters it returns "unlimited" which I assumed meant that there were no limits in place, but that is not correct - there was a 2GB limit on virtual memory:

>ulimit
unlimited

>ulimit -v
2097152

>ulimit -v unlimited
>ulimit -v
unlimited

>java -version
java version "1.7.0_51"
OpenJDK Runtime Environment (IcedTea 2.4.4) (ArchLinux build 7.u51_2.4.4-1-x86_64)
OpenJDK 64-Bit Server VM (build 24.45-b08, mixed mode)

Offline

#4 2014-01-28 05:55:13

jasonwryan
Anarchist
From: .nz
Registered: 2009-05-09
Posts: 30,424
Website

Re: What is limiting memory that Java can use? [closed]

Please don't use Closed: it denotes a locked thread. Use Resolved, or Solved instead.


Arch + dwm   •   Mercurial repos  •   Surfraw

Registered Linux User #482438

Offline

#5 2014-01-28 06:19:00

Awebb
Member
Registered: 2010-05-06
Posts: 6,262

Re: What is limiting memory that Java can use? [closed]

Is this de default behavior or did you change the ulimit at some point?

Offline

Board footer

Powered by FluxBB