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?
stev0931Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

afibarraCommented:
You can try the:

-XX:PermSize and -XX:MaxPermSize

Parameters.
0
stev0931Author Commented:
I don't see how that would impact anything - those parameters affect the perm gen space.  I am interested in configuring the heap space.
0
Mick BarryJava DeveloperCommented:
-Xms128M -Xmx1024M
0
Become a Certified Penetration Testing Engineer

This CPTE Certified Penetration Testing Engineer course covers everything you need to know about becoming a Certified Penetration Testing Engineer. Career Path: Professional roles include Ethical Hackers, Security Consultants, System Administrators, and Chief Security Officers.

HegemonCommented:
What is the JVM, what is the OS, is it 32bit or 64 bit, how much physical memory is installed ?
0
stev0931Author Commented:
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.
0
stev0931Author Commented:
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?
0
Mick BarryJava DeveloperCommented:
-Mx1g will set the maximum heap size to 1Gb
0
stev0931Author Commented:
That results in this error message:

Unrecognized option: -Mx1g
0
Mick BarryJava DeveloperCommented:
sorry thats a typo, missed the X.
Its the option you are already using
0
stev0931Author Commented:
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?
0
Mick BarryJava DeveloperCommented:
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
0
stev0931Author Commented:
Is there any good workaround for this issue?
0
Mick BarryJava DeveloperCommented:
no
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
HegemonCommented:
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.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Java

From novice to tech pro — start learning today.