I'm totally fed up and disgusted of having to guess a good value for the -Xmx
command-line option, having my applications crash with OutOfMemoryException
, having to modify the -Xmx
value and having to restart my applications all the time.
Is there a way to make JVM act normal so that it wouldn't require a -Xmx
option, and would allocate and free memory directly from the OS just as any normal application would? Is there some GC which is more efficient, aggressively returning memory to the OS when objects are freed?
If I remember correctly, Java has its roots in embedded environments, but has long past grown in popularity and spread to all kinds of systems. Surely there must be a way to do this in the 21st century? There are many use-cases where an application may require anywhere from a few kilobytes to several terabytes of memory, and the cumbersome -Xmx
is really getting in the way.
(Reminder to self: Since there are no good answers iteratively try out some other GC-s and random command line options in cargo cult fashion)