When to use -Xms and -Xmx?

A

Ahmed Moustafa

I allocate memory to my app using -Xmx. When would I need to use -Xms?

Thanks in advance!
 
T

Tris Orendorff

I allocate memory to my app using -Xmx. When would I need to use -Xms?

Thanks in advance!

"-Xms" can be used when you know your app uses few memory resources and you
want to make the app's footprint as small as possible.

--
-----BEGIN GEEK CODE BLOCK-----
Version: 3.12
GCS d++ s+:- a+ C+ UL++++ P+ L+ E- W+ N++ o- K++ w+ O+ M !V PS+ PE Y+ PGP
t+ !5 X- R- tv--- b++ DI++ D+ G++ e++ h---- r+++ y+++
------END GEEK CODE BLOCK------
 
M

Mark Thornton

Ahmed said:
I allocate memory to my app using -Xmx. When would I need to use -Xms?

Thanks in advance!

When you know you are going to use at least some minimum amount of
memory. Doing so then avoids a lot of heap expansion (and garbage
collection cycles). Try allocating say 250MB in 64K chunks (ensuring
that you keep a reference to each chunk). You will probably find it much
faster if -Xms is set to 250MB than if the default is used. The default
value for -Xms is quite low and it is rarely worthwhile setting a
smaller value.


Mark Thornton
 
A

Ahmed Moustafa

Mark said:
When you know you are going to use at least some minimum amount of
memory. Doing so then avoids a lot of heap expansion (and garbage
collection cycles). Try allocating say 250MB in 64K chunks (ensuring
that you keep a reference to each chunk). You will probably find it much
faster if -Xms is set to 250MB than if the default is used. The default
value for -Xms is quite low and it is rarely worthwhile setting a
smaller value.

So, it makes more sense to allocate the required memory by -Xms rather
than -Xmx, right?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,007
Latest member
obedient dusk

Latest Threads

Top