This section describes some general rules used by JVM to manage memory.
Generally, a JVM should be using these rules to manage memory:
When a JVM is invoked to run an application, it will ask the operating system
for enough memory to run the JVM itself and some free memory for the application
to create new objects.
When a new object is created, the JVM will allocate memory for that object out
of the free memory area.
When the free memory area is getting too small, the JVM will ask the operating
system for more.
When a object is no longer used by the application, it will be destroyed. Its
memory will be freed up and merged back to the free memory area.
When the free memory area is used up, and there is no more additional memory
available from the operating system, the JVM will stop the application and issue
the "Out of memory error".