4

We have an application which was running fine for one year. It is a web application, running under Tomcat 5.5 + JDK 1.5 under Microsoft Cluster on Windows Server 2003 Enterprise Edition Service Pack 2. The server has 11Gb of RAM (I know that it is useless!) with the following description "Physical Address Extension": I don't know what that means.

The Tomcat service is configured with the following parameters: -Xmx1024m -Xms128m

Since last week, the service doesn't want to start anymore and stops with the following error message: "Could not allocate enough heap space".

We tried several tests:

  • java -Xmx1024m -version => Failed
  • java -Xmx758m -version => Failed
  • java -Xmx512m -version => Passed

So we can use less memory for the maximum heap size, but it is not an acceptable workaround because the number of users will increase in few months and we need to set the maximum heap size to 1024Mb.

Also I don't understand why it worked fine and then suddenly it stopped working! It seems that the OS is now unable to allocate contiguous memory, or something else (page file size, user memory allocation, ...)

It's quite difficult to know if something changed (OS patch, configuration, ...) because the web application is running on the customer server and we don't have access to it.

Peter Lawrey
  • 525,659
  • 79
  • 751
  • 1,130
Eric Taix
  • 911
  • 1
  • 12
  • 24
  • 2
    `-Xmx1024m -Xmx128m`, really? Do you mean `-Xmx1024m -Xms128m` (note the -Xms)? – Thomas Apr 26 '11 at 09:25
  • Physical Adress Extension: http://en.wikipedia.org/wiki/Physical_Address_Extension - It means 32-bit processors can access more than 4 GB of ram. – Thomas Apr 26 '11 at 09:26
  • Also I forgot to say that we found a JRE 1.6 installed in "C:\Program Files\Java\jre1.6.0_07". The JDK (ie 1.5) is not in the system path but the tests above used the JDK and not the JRE. Also Tomcat is configured to use the JDK. – Eric Taix Apr 26 '11 at 09:27
  • Ouups sorru: Yes it is -Xmx1024m -Xms128m – Eric Taix Apr 26 '11 at 09:28
  • Try other JVM - Lastest 1.6, latest 1.5, latest 1.7. There can be something wrong with JVM – bugs_ Apr 26 '11 at 09:31

4 Answers4

6

Java requires continous memory. On 32-bit OSes this limits you to between 1.2 and 1.4 GB on Windows. However if your memory is fragmented due to other programs which are running, you might get a much smaller region of memory.

You won't get this problem with a 64-bit OS and you can even allocate far more memory to the jVM as well (if you use a 64-bit JVM)

Peter Lawrey
  • 525,659
  • 79
  • 751
  • 1,130
  • ... I know this upper boundary. Was a real showstopper when I tried to precompile some weblogic stuff on a monster laptop with 32 bit XP. 4 gig physical memory installed, no way to grab more then 1.4 gig and that was not enough. – Andreas Dolk Apr 26 '11 at 09:43
  • This is partly wrong. Java requires contiguous **virtual** memory. The presence of other programs is irrelevant. – David Balažic May 20 '19 at 16:40
  • better: whether other programs are running, is irrelevant; what might be relevant is if other programs installed DLLs that get loaded into every program, like the JVM – David Balažic May 20 '19 at 17:09
  • @DavidBalažic On windows, TSR programs and libraries can be loaded with addresses which the same for all applications. This uses up virtual address space for the JVM (and all programs) – Peter Lawrey May 21 '19 at 17:27
1

I've got some news about my problem.

This seems to be due to a Windows security update ! This Microsoft security update prevents java applications to allocate a large amount of contiguous memory...

More information here: http://support.microsoft.com/kb/971812

We will check if the patch solves this problem. Stay tuned

Eric Taix
  • 911
  • 1
  • 12
  • 24
  • I have a similar problem on Windows 7 (developer machine). Apps that used to work start having problems and I have to lower mem. settings. Still, I see only Windows Server versions mentioned in the security bulletin... – Stijn de Witt Aug 16 '13 at 13:25
0

Also I don't understand why it worked fine and suddenly it stopped to work ! It seems that the OS is now unable to allocate contiguous memory, or something else (page file size, user memory allocation, ...)

It's quite difficult to know if something changed (OS patch, configuration, ...) because the web application is running on the customer server and we have no access to it.

Well, you should check how much memory is available and if it's not enough, you should check what is consuming that much memory.

Other than that, you'd have to talk to your customer and find out if they did changes to the server and if so, what they did change.

Without knowing more it's really hard up to impossible to give any qualified advice on why you can't allocate more memory.

Community
  • 1
  • 1
Thomas
  • 87,414
  • 12
  • 119
  • 157
0

It probably means the OS can not allocate enough continuous memory. Do you still have the problem after OS restart? Does the system report it has 11 Gb of RAM? Windows's implementation of PAE is not the best one, so it could cause problems. Try updating to a newer JDK, if that fails, you'd need a 64-bit machine.

Denis Tulskiy
  • 19,012
  • 6
  • 50
  • 68
  • Our customer said us that he rebooted the server. So I suppose he did it ! – Eric Taix Apr 26 '11 at 10:18
  • Our customer said us that he rebooted the server. So I suppose he did it ! But I can't really understand why it worked last week and suddenly it can't. Also I ran a simple VMWare VM with only 1Go of RAM (Windows XP) and I was able to allocation up to 1.2Go (java -Xmx1200m -version") I know that without informations about what the customer did on the server, it will be very difficult to solve this issue. Is there any utility to see (in a graphical manner for example), how many continuous memory is available on the OS ? – Eric Taix Apr 26 '11 at 10:24
  • @Eric Talx: you have to set -Xms1000m (starting memory), because setting only max value won't actually allocate that much memory. – Denis Tulskiy Apr 26 '11 at 11:23