The new keyword allocates memory on the Java heap. The heap is the main pool of memory, accessible
to the whole of the application.
If there is not enough memory available to allocate for that
object, the JVM attempts to reclaim some memory from the heap with a garbage
collection.
If
it still cannot obtain enough memory, an OutOfMemoryError is thrown, and
the JVM exits.
No comments:
Post a Comment