Upgrade to Pro — share decks privately, control downloads, hide ads and more …

“Show Me the Garbage!”, Understanding Garbage C...

“Show Me the Garbage!”, Understanding Garbage Collection

“Just leave the garbage outside and we will take care of it for you”. This is the panacea promised by garbage collection mechanisms built into most software stacks available today. So, we don’t need to think about it anymore, right? Wrong! When misused, garbage collectors can fail miserably. When this happens they slow down your application and lead to unacceptable pauses. In this talk we will go over different garbage collectors approaches in different software runtimes and what are the conditions which enable them to function well.

Avatar for Haim Yadid

Haim Yadid

June 17, 2019

Other Decks in Programming

Transcript

  1. malloc / free • new / malloc () to create

    object • delete() / free() release an object
  2. I don’t miss it • Dangling pointers / Double free

    • Memory leaks • Fragmentation / Degradation • Locality
  3. Reference Counting Concurrency Concurrency - Every change to reference requires

    a memory barrier Very bad for highly concurrent systems Mostly relevant for single threaded
  4. Latency What is the possibility that the GC will affect

    your transaction time and for how long
  5. Collectors Attributes Single Threaded Stop the World Concurrent Parallel VS

    VS Monolithic Incremental VS Conservative Precise VS
  6. Mark & Sweep : Sweep Sweep through the heap and

    collect all unmarked objects Maintain a list of free memory portions Work: O(#Objects and fragments in Heap) Heap Unreachable Reachable Free
  7. Mark Compact Moving objects to make bigger free contiguous spaces

    Heap Heap Work: O(#Objects and fragments in Heap)
  8. Copy collector Move all live objects to another space From

    Space To Space Work: O(Size of live set) Memory: x2
  9. Not Moving Moving Non generational Generational Low latency Latency can

    be high* High Overhead (up to 25%) Lower overhead (5% considered normal) Precise Precise Memory overhead *2 Memory overhead configurable * with the exception of Azul C4 zGC and Shenandoah