WHO TAKES OUT YOUR TRASH? @sannekalkman

🔮

🔮 💻

🔮 💻 Magic is just (computer) science you don’t understand yet

🧠 Allocate memory

🧠 🔍 Allocate memory Find the garbage

🧠 🔍 🗑 Allocate memory Find the garbage Free up memory

REFERENCE COUNTING If nothing points to it, nothing’s using it

REFERENCE COUNTING

REFERENCE COUNTING name = "webcamp"

REFERENCE COUNTING name name = "webcamp" "webcamp" 1

REFERENCE COUNTING name name = "webcamp" other_name = name "webcamp" 1

REFERENCE COUNTING name name = "webcamp" other_name = name "webcamp" other_name 2

REFERENCE COUNTING name name = "webcamp" other_name = name "webcamp" name = nil other_name 2

REFERENCE COUNTING name name = "webcamp" other_name = name "webcamp" name = nil other_name 1

REFERENCE COUNTING name name = "webcamp" other_name = name "webcamp" name = nil other_name = nil other_name 1

REFERENCE COUNTING name name = "webcamp" other_name = name "webcamp" name = nil other_name = nil other_name 0

REFERENCE COUNTING name name = "webcamp" other_name = name "webcamp" name = nil other_name = nil other_name 0

CYCLES

CYCLES one = { other: nil }

CYCLES one = { other: nil } one { other: nil } 1

CYCLES one = { other: nil } two = { other: one } one { other: nil } 1

CYCLES one = { other: nil } one { other: nil } 1 two { other: one } 1 two = { other: one }

CYCLES one = { other: nil } one { other: nil } 2 two { other: one } 1 two = { other: one }

CYCLES one = { other: nil } one { other: nil } 2 two { other: one } 1 two = { other: one } one[:other] = two

CYCLES one = { other: nil } one { other: two } 2 two { other: one } 1 two = { other: one } one[:other] = two

CYCLES one = { other: nil } one { other: two } 2 two { other: one } 2 two = { other: one } one[:other] = two

CYCLES one = { other: nil } one { other: two } 2 two { other: one } 2 two = { other: one } one[:other] = two one = nil two = nil

CYCLES one = { other: nil } one { other: two } 1 two { other: one } 2 two = { other: one } one[:other] = two one = nil two = nil

CYCLES one = { other: nil } one { other: two } 1 two { other: one } 1 two = { other: one } one[:other] = two one = nil two = nil

MARK & SWEEP If you can’t get to it, you can’t be using it

MARK & SWEEP

MARK & SWEEP

MARK & SWEEP

MARK & SWEEP

MARK & SWEEP

MARK & SWEEP

MARK & SWEEP

MARK & SWEEP

MARK & SWEEP

COPYING COLLECTION Keep your stuff together

COPYING COLLECTION 0 2 3 4 5 7

COPYING COLLECTION 0 0 2 3 4 5 7

COPYING COLLECTION 0 0 2 2 3 4 5 7

COPYING COLLECTION 0 0 2 2 3 3 4 5 7

COPYING COLLECTION 0 0 2 2 3 3 4 4 5 7

COPYING COLLECTION 0 0 2 2 3 4 3 4 5 5 7

COPYING COLLECTION 0 0 2 2 3 4 5 3 4 5 7 7

COPYING COLLECTION 0 0 2 2 3 4 5 3 4 5 7 7

GENERATIONAL COLLECTION If you’ve been using it for a while, it’s probably important

GENERATIONAL COLLECTION New objects Old objects D

GENERATIONAL COLLECTION New objects Old objects D

GENERATIONAL COLLECTION New objects Old objects D

GENERATIONAL COLLECTION New objects Old objects D

GENERATIONAL COLLECTION New objects Old objects D

GENERATIONAL COLLECTION New objects Old objects D

GENERATIONAL COLLECTION New objects Old objects D

GENERATIONAL COLLECTION New objects Old objects D

GENERATIONAL COLLECTION New objects Old objects D

GENERATIONAL COLLECTION New objects Old objects D

GENERATIONAL COLLECTION New objects Old objects D

GENERATIONAL COLLECTION New objects Old objects D

GENERATIONAL COLLECTION New objects Old objects D

🔮 💻 Garbage collection is no longer magic!

LET ME KNOW WHAT YOU THINK! Rate this talk at joind.in Tweet me @sannekalkman Find me in person later!