sbeckett
Posts: 35
Joined: Thu Aug 25, 2005 12:12 am

Java heap size parameters don't work

I'm using Advanced Installer 3.6.1 to create a java project.

I see in the Edit JVM Parameters dialog box the option to set Initial or Maximum heap size to a Percentage of Total Memory value.

However, if I use that option my application won't launch at all, and I can find no mention of it in the Sun JRE documentation or any other Java documentation I've searched.

Does this option work? And if it does, can you point me to any documentation that might help me debug why it's not working for me?
Mihai
Posts: 38
Joined: Wed Mar 23, 2005 12:19 pm

Hi,

What percent of memory and what version of JRE you use?

The Maximum heap size corresponds to the Xmx java option. This option specify the maximum size, of the memory allocation pool. This value must a multiple of 1024bytes, greater than 2MB. If you use the percentual unit then the resulting value must accommodate those rules.

The application could not start with the actual percent because it can be to big or to small. You can try to decrease/increase the value until it has a appropriate working value.
It will be easier to test that by directly editing the INI file installed next to the application ("Virtual Machine Parameters" entry).

For more information about you the percentual option you can visit:
http://www.advancedinstaller.com/user-g ... ialog.html
And to find more about the Xmx option you can search on Google with the keywords:
Xmxn java sun
http://www.google.com/search?hl=ro&q=Xm ... lr=lang_en

If the problem persist, please let me know.

All the best,
Mihai
Mihai Udrea
Advenced Installer Team
sbeckett
Posts: 35
Joined: Thu Aug 25, 2005 12:12 am

JRE 1.5.0_04, 2GB physical RAM on the box.

I was trying to set the JVM max heap size to 75% and that fails every time.

Setting it to 50% works fine. Anything above 65% fails instantly. It's unrelated to other running programs.

Any idea why 65% works but 66% won't?

Perhaps there's a hard limit at 65% of available RAM?

As to the documentation, I can find all sorts of man page stuff, but none of those refer to the percentage parameter to Xmx. Advanced Installer appears to be the only one.

I'd like something beyond:

"-Xmxn
Specifies the maximum size of the memory allocation pool. This value must be greater than 1000. To modify the meaning of n, append either the letter k for kilobytes or the letter m for megabytes."
sbeckett
Posts: 35
Joined: Thu Aug 25, 2005 12:12 am

The previous tests were on a WinXP Pro box.

Testing on a Win2K box with 1GB RAM, I was able to set the percentage as high as 132% and still launch the app.

Once I moved to 133%, the JRE would no longer launch.

It would seem there's a threshold around 1.3GB?
Mihai
Posts: 38
Joined: Wed Mar 23, 2005 12:19 pm

Hi,

The percentage parameter is specific to Advanced Installer Java Launcher. At the runtime, the launcher sets the maximum heap size of the JVM not to a fixed value (like -Xmx78M) but to a percent of the total physical memory of host machine (-Xmx50P <=> -Xmx1024M if the host machine will have 2GB of RAM).

So if you will use the 50% value on a machine with:
- 1 GB of RAM the maximum heap size will be set to 512M
- 2 GB of RAM the maximum heap size will be set to 1024M

The maximum heap size of a Java application is limited by three factors:
- the process data model (32-bit or 64-bit) and the associated operating system limitations,
- the amount of virtual memory available on the system,
- the amount of physical memory available on the system.

For a 32-bit process model, the maximum virtual address size of the process is typically 4 GB, though some operating systems limit this to 2 GB or 3 GB.

The size of the Java heap for a particular application can never exceed or even reach the maximum virtual address space of the process data model.

The maximum heap size is typically -Xmx3800m (1600m for 2 GB limits), though the actual limitation is application dependent.

Both Windows 2K and XP have a virtual address space memory limit per 32-bit process of 2GB.

You can find more about tunning the JVM from:
http://java.sun.com/performance/referen ... ction4.1.2

All the best,
Mihai
Mihai Udrea
Advenced Installer Team
joshua.shapiro
Posts: 1
Joined: Tue Sep 19, 2006 7:59 pm

Percent Memory Problems

Part of the reason my company purchased this software was the advertised ability to set the maximum heap size as a percent of physical memory.

What I have discovered is that this functionality is highly machine dependent and uses jvm command line arguments that are advertised by java to be "Subject to Change".

If I am distributing my software to a variety of users on different computers, What is the most robust value to use if i want to use the Percent of Physical memory.
Peter R
Posts: 16
Joined: Tue Oct 31, 2006 6:36 pm

Part of the reason my company purchased this software was the advertised ability to set the maximum heap size as a percent of physical memory.
The same is true for us. Unfortunately, this setting does not really work as it would seem - often, Java applications fail to launch, without any error messages. Basically, nothing happens (except a very brief splash screen) when the user double-clicks. This can happen with almost any amount of requested memory, even when asking for less than 50% of physical RAM and less than 512 MB.

The problem is that the launcher only looks at physical RAM to calculate the requested heap space for the -Xmx parameter. However, if the requested RAM is not available as contiguous virtual memory, the application will not launch. Actually, the launcher will crash hard without any error dialogs.

This problem has troubled a number of our customers for several months. We eventually figured out the cause (unavailable virtual memory), and reported this to support three months ago (Feb 2, 2007). Since then, two major updates of AI have been released, but this problem has not be fixed. This is rather frustrating, since it forces us to (a) ship our software with low memory settings so that it starts reliably, and then (b) write additional code to programatically edit the .ini files to enable customers to use our software with larger data sets.

Return to “Common Problems”