Gaurav
Gaurav

Reputation: 1516

Does -Xmx stop automatic GC till maximum memory is consumed?

My question is simple. I have an application that specifies the "-Xmx 3G" command line option. Does this mean that no garbage collection will take place in the application till all (or say 80%) the 3GB of memory is consumed? Any further reading material would be appreciated as well.

Upvotes: 0

Views: 186

Answers (2)

Peter Lawrey
Peter Lawrey

Reputation: 533810

No. A minor gc can occur even before the minimum memory -ms has been reached. The JVm reserves the maximum memory -mx on startup. However you can get full collections before this size is reached.

Upvotes: 1

dty
dty

Reputation: 18998

No. A simple test would demonstrate that!

Upvotes: 1

Related Questions