Slide 1

Slide 1 text

Minor GC 1. Let us assume that there are already objects on the Eden space when we start(Blocks 01 to 06 marked as used memory) 2. The application creates a new object(07) 3. JVM tries to get required memory from Eden space, but there is no free space in Eden to accommodate our object and hence JVM triggers minor GC

Slide 2

Slide 2 text

Minor GC Heap memory Young generation Old generation (Tenured space) EDEN Survivor space S0 S1 01 02 03 04 05 06 07 (new object) Orphan Used memory Free memory

Slide 3

Slide 3 text

Minor GC Heap memory Young generation Old generation (Tenured space) EDEN Survivor space S0 S1 01 02 03 04 05 06 07 (new object) Orphan Used memory Free memory

Slide 4

Slide 4 text

Minor GC Heap memory Young generation Old generation (Tenured space) EDEN Survivor space To survivor space Orphan Used memory Free memory S1 01 02 03 04 05 06 07 (new object)

Slide 5

Slide 5 text

Minor GC Heap memory Young generation Old generation (Tenured space) EDEN Survivor space To survivor space Orphan Used memory Free memory S1 01 03 05 07 (new object)

Slide 6

Slide 6 text

Second Minor GC 1. Let us assume that some time have passed and there are more objects on the Eden space now(Blocks 07 to 13 marked as used memory) 2. The application creates a new object(14) 3. JVM tries to get required memory from Eden space, but there is no free space in Eden to accommodate our object and hence JVM triggers second minor GC

Slide 7

Slide 7 text

Minor GC Heap memory Young generation Old generation (Tenured space) EDEN Survivor space S0 S1 01 08 09 10 11 13 14 (new object) Orphan Used memory Free memory 07 12 01 03 05

Slide 8

Slide 8 text

Minor GC Heap memory Young generation Old generation (Tenured space) EDEN Survivor space From survivor space To survivor space 01 08 09 10 11 13 14 (new object) Orphan Used memory Free memory 07 12 01 03 05

Slide 9

Slide 9 text

Minor GC Heap memory Young generation Old generation (Tenured space) EDEN Survivor space From survivor space To survivor space 08 09 11 14 (new object) Orphan Used memory Free memory 07 12 01 03 05 10 13

Slide 10

Slide 10 text

Minor GC Heap memory Young generation Old generation (Tenured space) EDEN Survivor space From survivor space S1 14 (new object) Orphan Used memory Free memory 07 01 03 10 13 S0

Slide 11

Slide 11 text

13 more Minor GC cycles later 1. This keeps on repeating for each minor GC and the survivors are shifted between S0 and S1 and their age is incremented. Once the age reaches the "max age threshold", 15 by default, the object is moved to the "Tenured space"

Slide 12

Slide 12 text

Minor GC Heap memory Young generation Old generation (Tenured space) EDEN Survivor space S0 S1 14 Orphan Used memory Free memory 25 03 10 13 01 28 29