Link to home
Start Free TrialLog in
Avatar of stev0931
stev0931

asked on

JVM memory specification on startup

I am running into a problem where I have an installer for a Java application.  I want to run this Java application with the maximum amount of memory possible and have tested with -Xmx1024M without a problem.

Apparently, some people have run into issues where they have plenty of memory, but they're getting 'not enough memory errors'.  This can be solved by reducing the -Xmx argument.

How do I tell the JVM to use up to 1024M, but less if it can't?  i.e. How do I get this app to run reliably and with a lot of memory?
SOLUTION
Avatar of afibarra
afibarra
Flag of Mexico image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of stev0931
stev0931

ASKER

I don't see how that would impact anything - those parameters affect the perm gen space.  I am interested in configuring the heap space.
Avatar of Mick Barry
-Xms128M -Xmx1024M
What is the JVM, what is the OS, is it 32bit or 64 bit, how much physical memory is installed ?
Thanks!  I'll give those suggestions a try now.

This application must be deployed to multiple platforms: WinXP, MacOS, Linux, 32bit, 64bit.

JRE 1.6 or higher is required.  We can specify whatever we want for minimum physical memory - right now, I think it's 1GB, 2GB for Vista, ...

I should note that this error is occurring on machines with 2GB+ RAM running XP Pro 32bit.
According to this,

http://bugs.sun.com/view_bug.do?bug_id=4408373

it looks like what I am trying to do (find the maximum amount of memory up to 1GB I can allocate for my heap and set the -Xmx to that) may not be supported.  

I can't believe this is true though.  There has to be some sort of workaround for this, right?
-Mx1g will set the maximum heap size to 1Gb
That results in this error message:

Unrecognized option: -Mx1g
sorry thats a typo, missed the X.
Its the option you are already using
With that option though, the JVM will fail to get created if I ask for more than the OS is willing to do (if for example virtual memory is configured quite low).  

My question stands:

According to this,

http://bugs.sun.com/view_bug.do?bug_id=4408373

it looks like what I am trying to do (find the maximum amount of memory up to 1GB I can allocate for my heap and set the -Xmx to that) may not be supported.  

I can't believe this is true though.  There has to be some sort of workaround for this, right?
there isn't as explained in the RFE
If an app does not have enough memory then technically it does not meet the memory requirements of the application
Is there any good workaround for this issue?
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
You didn't answer what JVM you are running - Sun's Hotspot or any other, i.e. JRockit and how much physical memory is installed on the machine you are experiencing the problem on. Also please attach the exact stack trace (a couple of top lines) as the "not enough memory" problem can be of several different types. Then I hope I will be able to recommend a solution.