Jump to content
Excelsior Forums
Sign in to follow this  
klehmann

Reduce memory usage of application

Recommended Posts

Hi!

We 're developing a swing application that stores data in Lotus Notes databases. On startup the application uses 40-50 MB of memory (according to the task manager).

With heavy usage I can extend this value up to 150-200 MB (my machine has 1,25 GB RAM) which shrinks again after some time back to 50 MB.

Is there any documentation about the garbage collection strategy JET compiled applications use? I would like to know whether 150/200 MB memory usage is just a behavior on my machine and depends on the total memory available or if this amount is really necessary.

Are there any ways to force JET to release memory as soon as possible? We have a customer with a terminal server installation who get's quite worried about this kind of resource usage. How does JET behave on a machine with 256 MB of RAM?

Best regards,

Karsten Lehmann

Share this post


Link to post
Share on other sites

Check out the Knowledge Base article "HOWTO: Fine tune application memory consumption"

What is the value of -Xmx when you run your app on the Sun JRE?

Are you using adaptive or fixed heap size in the version compiled by Excelsior JET?

How do you measure memory consumption? The most reliable way is to watch Commit Charge in Task Manager's Performance tab. The "Mem Usage" and "VM Size" columns in the Processes tab can show incorrect results.

What is the behavior of your application on the same version of the Sun JRE with respect to memory allocation? If it also uses too much memory, we can help you find out what causes it.

Share this post


Link to post
Share on other sites

Thanks for the article. We'll experiment with the memory settings, especially with the defragment flag.

Currently we just develop with Java and then distribute the JET compiled version. When I run the application inside Eclipse, I do not use -Xmx, so with heavy usage, I get an out of memory exception. We have not tried to find the right -Xmx setting, because it depends on how much MindMaps the user opens (it's a MindMapping solution) and how large the maps are. So it's always possible to completely fill the memory allocated by -Xmx.

In JET we use adaptive heap size, which works well for this type of application (low memory usage at startup, higher usage while working with the application). Does the application reach any "heap limit" with adaptive heap size? So when does the GC occur with the adaptive setting? Only periodic with 1.1% CPU?

So far we've measured memory with the value in the process tab, but we've experienced some strange values when the application is minimized or the window is hidden (e.g. 6 MB usage displayed in task manager process tab). Do you know if there is some application that helps measuring the real memory usage (freeware/shareware)?

Regards,

Karsten Lehmann

Share this post


Link to post
Share on other sites

I'd suggest that you first experiment with the jet.gc.ratio property - a number of customers have reported good results after they adjusted it.

If you have heap size set to "Adaptive", it will never exceed 75% of available physical memory, so as to avoid paging. GC then occurs either when that limit is reached, or periodically according to the jet.gc.ratio setting. This means that on your 1.25GB system with, say, 250MB occupied by the system and other apps, your compiled application will use up to 750MB of memory before GC if you set both jet.gc.heaplimit and jet.gc.ratio to 0 (first setting means adaptive heap size).

However, if the system is under heavy load or has little RAM, the use of adaptive heap limit is not recommended in Excelsior JET 3.7. This problem will be addressed in Excelsior JET 4.0, due this fall. It will also have other improvements in the memory manager.

FYI: In the Sun HotSpot Client VM 1.4.2, if you do not set -Xmx, heap size is set to 64MB. Not sure about 5.0 and the server VM.

For process monitoring, have a look at Process Explorer from SysInternals. It can display lots of useful information about the running processes beside memory use.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×