~/talk

Defragging Ruby

Talkat RubyConf AU 2017 · on Friday, 2017-02-10· [ruby]
slides:none on file

Implements a live compaction for MRI Ruby using a two-finger compaction algorithm and a four‑pass GC (mark, compact, update references, free forwards), with objects on 16,384‑byte pages and 40‑byte slots; demonstrates tagged pointers (integers encoded in low bits, max ≈ 2^62−1), builds a Raspberry Pi + MSP430 cat‑poop scale as a motivating project, and shows a Rails heap where movable pages with free slots drop from 528 to 167 after calling gc.compact, noting that object IDs change until a fix is added.

AI-written summary · about

  1. 0:00Start
  2. 7:28Bathroom Scale
  3. 7:44msp430
  4. 14:00Ruby's Memory
  5. 15:05Memory has many Pages
  6. 15:19Pages have many slots
  7. 15:32Slots can be empty, or not
  8. 15:59Slot is 40 bytes
  9. 16:10byte = 8 bits
  10. 17:40Memory Layout
  11. 20:01Addresses divisible by 40
  12. 20:43C = Ruby
  13. 22:00Verification in Ruby
  14. 22:38Max Int (without allocations)
  15. 24:16Slots live in Pages
  16. 24:33Free Slots are in a list
  17. 28:03Confusing Nomenclature
  18. 30:02Normal Malloc
  19. 30:32Aligned Malloc 10
  20. 31:22Ruby Page
  21. 32:56Page address tricks
  22. 34:11Wasted page space
  23. 35:11Find Page For Object
  24. 36:21Fragmentation / Locality
  25. 38:44finger compaction
  26. 39:57Reference Updating
  27. 40:57Hash Keys
  28. 42:27"Hidden" Objects
  29. 42:58Mark Phase
  30. 43:13Two Marking Functions
  31. 43:37Passes on the Heap
  32. 43:56Compaction Code
  33. 44:12Pre Compaction
  34. 46:14Production Use
~/search
type to search 6,249 conferences, 138,987 speakers and 185,172 talks
~/help
cmdctrl k
search every conference, speaker and series
/
focus the filter search
h
home
c
conferences
s
speakers
e
series
t
light / dark — the status bar button does the same
?
this help
esc
close this, then clear every filter — or just the search, while you are typing in it

Ignored while you are typing. Pages without a filter rail have no search to focus.