JVM Memory Model
Java Memory Model Heap : Used for allocating new objects and Java Runtime classes. Minor GC : When Eden Space ( in Young generation ) is filled, garbage collection happens, it deletes the objects not referenced, it moves the longer living objects to Surviving spaces and even longer aged objects( beyond a threshold) to Old Generation. All the Garbage Collection events are "Stop The World" events, means all the threads stop when GC thread runs. Minor GCs are fast and not noticebale but major GC events can be clearly noticeable and even cause apps to unresponsive during that time. When JVM falls short of stack space, it throws StackOverFlowError and when it runs out of heap space, it throws OutOfMemoryError. Interned Strings are kept in a Hashtable in Permanent Generation. Interned strings are the string literals appearing explicitly in code or created by explicitly calling intern() method on String object. ("j"+"v"+"m").intern