Use of -xms and -xmx to increase heap memory *URGENT*
2 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Pary_Alavi
Posted On:   Sunday, August 18, 2002 05:14 AM

Hello I work on an application that parses a file and creates objects and intended to be used on Windows and Linux OS. I have to kept these objects in a vector because the program needs all of objects to decide on some relation between them. Any way,As my vector may become very large,I used "java -Xms255m -Xmx255m" to increse the heap size.Now I have some questions: 1. If the system running my application has only 32MB of ram, what happens? Does operating system handle this and use swap files? I mean do I get an "out of memory error"? 2. does JVM allocate the Xms255m of memeory for heap, although it does not need to that much of heap memory or it does alloc   More>>


Hello


I work on an application that parses a file and creates objects and intended to be used on Windows and Linux OS. I have to kept these objects in a vector because the program needs all of objects to decide on some relation between them.


Any way,As my vector may become very large,I used "java -Xms255m -Xmx255m" to increse the heap size.Now I have some questions:


1. If the system running my application has only 32MB of ram, what happens? Does operating system handle this and use swap files? I mean do I get an "out of memory error"?


2. does JVM allocate the Xms255m of memeory for heap, although it does not need to that much of heap memory or it does allocating only when needed?

Regards,
Pary

   <<Less

Re: Use of -xms and -xmx to increase heap memory *URGENT*

Posted By:   Thomas_Wheeler  
Posted On:   Monday, August 26, 2002 08:47 AM

1. As long as the operating system is capable of allocating the requested space, you will not get an error. That space comes from physical memory and virtual memory (swap). To my knowledge, all of the desktop/workstation operating systems commonly in use today (Win95+, Unix (Linux, AIX, Solaris, HP-UX, BSD, IRIX...), MacOS) support virtual memory, so as long as your swap file|partition is set up to support that much memory your application will work. However... as your application uses more memory, the performance of the system will degrade. The degradation depends largely on the application's working set: the data it is working with most of the time. If the working set gets large enough, you wind up thrashing. Most of the time is spent swapping and your system performance degrades quickly towards being useless.


2. This is dependent on how the operating system allocates memory. Some operating systems are designed to ensure that if X memory is requested by an application (such as a Java VM) that the system can fulfill that request immediately. Others make the assumption that applications tend to request more than they need, and only parcel out the memory as it is actually used. (Those are two major strategies, anyway.)


If you run into performance or memory allocation problems, you will have to tune your application. Common strategies include reducing the working set; compacting the data in some fashion (for example using bit fields instead of booleans); and calculating data on-the-fly instead of keeping it in memory.


-Thomas

Re: Use of -xms and -xmx to increase heap memory *URGENT*

Posted By:   eimi_nos  
Posted On:   Sunday, August 18, 2002 06:09 AM

According to my experience (sorry I am not very acquanted with the VM specification, and my environment is Mac OSX), if the value set by -Xms was too high relative to Ram and swap file size, an error message is displayed;


"Error occurred during initialization of VM


"Incompatible initial and maximum heap sizes specified


Abort


Even if the actual size of memory which an application uses, the the specified size of memory seems to be allocated to the VM.


I hope more knowledgeable reply follows.
About | Sitemap | Contact