DOC PREVIEW
UT Dallas CS 4337 - #Sebesta ch06B Java Garbage Collection

This preview shows page 1-2-3-20-21-40-41-42 out of 42 pages.

Save
View full document
View full document
Premium Document
Do you want full access? Go Premium and unlock all 42 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 42 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 42 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 42 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 42 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 42 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 42 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 42 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 42 pages.
Access to all documents
Download any document
Ad free experience

Unformatted text preview:

Slide 1Understanding Memory ManagementThe Heap and the NurseryThe Heap and the NurseryThe Heap and the NurseryObject AllocationObject Allocation – small objectsObject Allocation – large objectsGarbage CollectionThe Mark and Sweep ModelThe Mark and Sweep ModelDynamic Garbage Collection ModeStatic Garbage Collection ModeCompactionCompactionSlide 16Java Garbage Collection BasicsThe main components of the JVMKey HotSpot JVM ComponentsPerformance BasicsWhat is Automatic Garbage Collection?Step 1. MarkingStep 2: Normal DeletionStep 2a: Deletion with CompactingWhy Generational Garbage Collection?Why Generational Garbage Collection?JVM GenerationsYoung Generation & Minor Garbage CollectionOld Generation & Major Garbage CollectionPermanent Generation & Full GC The Generational Garbage Collection ProcessFilling the Eden SpaceEden space & Minor Garbage CollectionSlide 34Slide 35Slide 36Promotion (from Young to Old generation)Promotion (from Young to Old generation)Promotion (from Young to Old generation)Java Garbage CollectorsVisual GC plugin for Visual VMSlide 42Java JVM Memory Management Garbage CollectionSource/Reference:https://docs.oracle.com/cd/E13150_01/jrockit_jvm/jrockit/geninfo/diagnos/garbage_collect.htmlhttp://www.oracle.com/webfolder/technetwork/tutorials/obe/java/gc01/index.htmlUnderstanding Memory Management•https://docs.oracle.com/cd/E13150_01/jrockit_jvm/jrockit/geninfo/diagnos/garbage_collect.html•Memory management is the process of allocating new objects and removing unused objects to make space for those new object allocations. •Some basic memory management concepts•The basics about object allocation and garbage collection in the Oracle JRockit JVM. •The following topics are covered: •The Heap and the Nursery•Object Allocation•Garbage CollectionThe Heap and the Nursery •Java objects reside in an area called the heap. •The heap is created when the JVM starts up and may increase or decrease in size while the application runs. •When the heap becomes full, garbage is collected. •During the garbage collection objects that are no longer used are cleared, thus making space for new objects. •Note that the JVM uses more memory than just the heap. •For example Java methods, thread stacks and native handles are allocated in memory separate from the heap, as well as JVM internal data structures.The Heap and the Nursery •The heap is sometimes divided into two areas (or generations) called the nursery (or young space) and the old space. •The nursery is a part of the heap reserved for allocation of new objects. •When the nursery becomes full, garbage is collected by running a special young collection. •All objects that have lived long enough in the nursery are promoted (moved) to the old space, thus freeing up the nursery for more object allocation. •When the old space becomes full garbage is collected there, a process called an old collection.The Heap and the Nursery •The reasoning behind a nursery is that most objects are temporary and short lived. •A young collection is designed to be swift at finding newly allocated objects that are still alive and moving them away from the nursery.•Typically, a young collection frees a given amount of memory much faster than an old collection or a garbage collection of a single-generational heap (a heap without a nursery).Object Allocation•During object allocation, the JRockit JVM distinguishes between small and large objects. •The limit for when an object is considered large depends on the JVM version, the heap size, the garbage collection strategy and the platform used, but is usually somewhere between 2 and 128 kB.•See for -XXtlaSize and -XXlargeObjectLimit for more information.Object Allocation – small objects•Small objects are allocated in thread local areas (TLAs). •The thread local areas are free chunks reserved from the heap and given to a Java thread for exclusive use. •The thread can then allocate objects in its TLA without synchronizing with other threads. •When the TLA becomes full, the thread simply requests a new TLA. •The TLAs are reserved from the nursery if such exists, otherwise they are reserved anywhere in the heap.Object Allocation – large objects•Large objects that don’t fit inside a TLA are allocated directly on the heap. •When a nursery is used, the large objects are allocated directly in old space. •Allocation of large objects requires more synchronization between the Java threads, •although the JRockit JVM uses a system of caches of free chunks of different sizes to reduce the need for synchronization and improve the allocation speed.Garbage Collection•Garbage collection is the process of freeing space in the heap or the nursery for allocation of new objects. This section describes the garbage collection in the JRockit JVM. •The Mark and Sweep Model•Generational Garbage Collection•Dynamic and Static Garbage Collection Modes•CompactionThe Mark and Sweep Model •The JRockit JVM uses the mark and sweep garbage collection model for performing garbage collections of the whole heap. •A mark and sweep garbage collection consists of two phases, the mark phase and the sweep phase. •The JRockit JVM uses two improved versions of the mark and sweep model. One is mostly concurrent mark and sweep and the other is parallel mark and sweep. You can also mix the two strategies, running for example mostly concurrent mark and parallel sweep.The Mark and Sweep Model •The JRockit JVM uses the mark and sweep garbage collection model for performing garbage collections of the whole heap. •During the mark phase all objects that are reachable from Java threads, native handles and other root sources are marked as alive, as well as the objects that are reachable from these objects and so forth. This process identifies and marks all objects that are still used, and the rest can be considered garbage. •During the sweep phase the heap is traversed to find the gaps between the live objects. These gaps are recorded in a free list and are made available for new object allocation.Dynamic Garbage Collection Mode •By default, the JRockit JVM uses a dynamic garbage collection mode that automatically selects a garbage collection strategy to use, aiming at optimizing the application throughput. •throughput, which optimizes the garbage collector for maximum application throughput. This is the default mode. •pausetime, which optimizes the garbage collector


View Full Document

UT Dallas CS 4337 - #Sebesta ch06B Java Garbage Collection

Download #Sebesta ch06B Java Garbage Collection
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view #Sebesta ch06B Java Garbage Collection and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view #Sebesta ch06B Java Garbage Collection 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?