SlideShare a Scribd company logo
Whippet: A practical
memory management
upgrade for Guile &
beyond
2 February 2025 – FOSDEM ’25
Andy Wingo
Igalia, S.L.
Agenda The big idea
❧
The results
❧
The future
❧
The big idea Whippet is a practical memory
management upgrade for Guile &
beyond
A practical
memory
management
upgrade for
Guile &
beyond
struct gc_options *options = NULL;
struct gc_stack_addr *stack_base = NULL;
struct gc_heap *heap;
struct gc_mutator *mut;
void *event_listener_data = NULL;
gc_init(options, stack_addr, &heap, &mut,
GC_NULL_EVENT_LISTENER, event_listener_data);
void *obj = gc_allocate(mut, 42);
options = gc_allocate_options();
gc_options_parse_and_set_many(options,
getenv("GC_OPTIONS"));
struct gc_mutator_roots roots; // Embedder-defined
gc_mutator_set_roots(mut, &roots);
// For generational configurations
gc_write_barrier(mut, obj, obj_size, edge, new_val);
// For cooperative safepoints
gc_safepoint(mut);
// For collectors that don't require copying
gc_pin_object(mut, ref);
static inline void
gc_trace_object(struct gc_ref ref,
void (*visit)(struct gc_edge edge,
struct gc_heap *heap,
void *visit_data),
struct gc_heap *heap,
void *trace_data,
size_t *size) { /* ... */ }
static inline void
gc_trace_mutator_roots(struct gc_mutator_roots *roots,
void (*trace_edge)(struct gc_edge edge,
struct gc_heap *heap,
void *trace_data),
struct gc_heap *heap,
void *trace_data) { /* ... */ }
A practical
memory
management
upgrade for
Guile &
beyond
Whippet: An
upgrade
relative to
BDW-GC
Performance: Bump-pointer allocation,
better parallelism
Features: Ephemerons and finalizers
that work
Behavior: Choice of workload-
appropriate collectors
Memory use: Compaction, adaptive
heap sizing (membalancer)
Whippet: An
upgrade with
a migration
path
Bridge, n.: Construction with two ends
and a path in between
Whippet: a GC library with compile-
time abstraction over embedder needs
and collector construction
Collector variants: MMC, PCC, BDW
MMC collector has optional
conservative tracing
stack roots
❧
global roots
❧
(optionally) intra-heap edges
❧
MMC Mostly-marking collector
MMC = nofl space + lospace
Nofl space “No free-list”
For objects less than 8192 bytes
Bump-pointer allocation
Excellent parallelism
Mostly-marking (Immix-derived),
occasionally compacting
12% overhead
Pinning (transitively due to
conservative roots, or permanently)
Optionally generational (sticky-mark)
Lospace “Large object space”
mmap allocation, freelist, deferred
release
Optionally generational (sticky-mark)
Whippet: An
upgrade
relative to
bespoke GCs
Language run-times often get stuck
with their GC
Whippet’s compile-time API
abstraction enables evolution
PCC Parallel copying collector
PCC = copy space + lospace
Copy space For objects less than 8192 bytes
Bump-pointer allocation
Excellent parallelism
Always compacting
100% overhead
Generational
PCC
Generational PCC = copy space + copy
space + lospace
2 MB nursery per processor active in
last cycle
1 survivor cycle for copy space, 0 for
lospace
Field-logging write barrier
Nursery memory range aligned, can be
quick XOR check
Still has 100% overhead
BDW Boehm-Demers-Weiser collector
Shim behind Whippet API
Different safepoint behavior: not
cooperative
No support for gc_trace_object
Not great parallelism
Higher memory overhead than MMC
A practical
memory
management
upgrade for
Guile &
beyond
Embed-only
No dependencies
C11
Hackable
Practical
testbench:
Whiffle
Scheme-to-C compiler: https://
github.com/wingo/whiffle
Ensure Whippet offers appropriate
API for embedders
❧
Allow more test cases to be written
before moving to Guile
❧
Handles vs stack maps
❧
Main motivation was testing; shook
out many bugs
A practical
memory
management
upgrade for
Guile &
beyond
The pivot:
Whippet API, but BDW collector
❧
MMC collector, with conservative
roots
❧
Generational MMC collector (write
barriers)
❧
Evacuating nursery?
❧
Shout-out to NLnet foundation for
helping us with this work!
A practical
memory
management
upgrade for
Guile &
beyond
WebAssembly+GC-to-C: Enable
standalone Guile compilation via Hoot ?
Ocaml, R, etc...
Results:
What do we
win with
Whippet?
Strict throughput improvements: 20-
40%
Access to smaller heap sizes: 30-50%
The Whippet Embeddable Garbage Collection Library
The Whippet Embeddable Garbage Collection Library
The Whippet Embeddable Garbage Collection Library
The Whippet Embeddable Garbage Collection Library
Results:
What do we
learn with
Whippet?
Conservative root-finding is OK
Generational GC is complicated, more
tuning needed
The Whippet Embeddable Garbage Collection Library
The Whippet Embeddable Garbage Collection Library
The Whippet Embeddable Garbage Collection Library
The Whippet Embeddable Garbage Collection Library
Future Guile, finally. This month!!!
Your language run-time?
Concurrent marking
LXR-inspired reference counting of old
generation?
Try it out! https://github.com/wingo/whippet
https://github.com/wingo/whiffle
https://nlnet.nl/project/Whippet/
wingo@igalia.com
Thanks!
Attic
New since
2023
PCC, generational PCC, precise field-
logging write barriers instead of card
marking, better parallelism, bug fixes,
embeddability, finalizers, dynamic
heap sizing (membalancer), less VMM
traffic, whiffle, tests, nlnet, platform
abstraction, options interface, extern
space, stats, HDR histogram,
renamings, nofl more eager

More Related Content

Similar to The Whippet Embeddable Garbage Collection Library (20)

PDF
How to build a feedback loop in software
Sandeep Joshi
 
PDF
Parallelism in a NumPy-based program
Ralf Gommers
 
PDF
Improving Apache Spark Downscaling
Databricks
 
PDF
Distributed deep learning optimizations for Finance
geetachauhan
 
PPTX
millions-gc-jax-2022.pptx
Tier1 app
 
PDF
Talk 160920 @ Cat System Workshop
Quey-Liang Kao
 
PPT
jvm goes to big data
srisatish ambati
 
PDF
Fast Insights to Optimized Vectorization and Memory Using Cache-aware Rooflin...
Intel® Software
 
PDF
Implementing data and databases on K8s within the Dutch government
DoKC
 
PDF
Move from C to Go
Yu-Shuan Hsieh
 
PDF
May2010 hex-core-opt
Jeff Larkin
 
PPTX
Lessons learned with kubernetes in production at PlayPass
Peter Vandenabeele
 
PDF
GPU cloud with Job scheduler and Container
Andrew Yongjoon Kong
 
PPTX
JVM Magic
Baruch Sadogursky
 
PDF
PuppetConf 2017: Kubernetes in the Cloud w/ Puppet + Google Container Engine-...
Puppet
 
PDF
5 Things I Wish I Knew About Gitlab CI
Sebastian Witowski
 
PPT
SF JUG - GWT Can Help You Create Amazing Apps - 2009-10-13
Fred Sauer
 
PPTX
Kubernetes - State of the Union (Q1-2016)
DoiT International
 
PDF
Adtech scala-performance-tuning-150323223738-conversion-gate01
Giridhar Addepalli
 
PDF
Adtech x Scala x Performance tuning
Yosuke Mizutani
 
How to build a feedback loop in software
Sandeep Joshi
 
Parallelism in a NumPy-based program
Ralf Gommers
 
Improving Apache Spark Downscaling
Databricks
 
Distributed deep learning optimizations for Finance
geetachauhan
 
millions-gc-jax-2022.pptx
Tier1 app
 
Talk 160920 @ Cat System Workshop
Quey-Liang Kao
 
jvm goes to big data
srisatish ambati
 
Fast Insights to Optimized Vectorization and Memory Using Cache-aware Rooflin...
Intel® Software
 
Implementing data and databases on K8s within the Dutch government
DoKC
 
Move from C to Go
Yu-Shuan Hsieh
 
May2010 hex-core-opt
Jeff Larkin
 
Lessons learned with kubernetes in production at PlayPass
Peter Vandenabeele
 
GPU cloud with Job scheduler and Container
Andrew Yongjoon Kong
 
PuppetConf 2017: Kubernetes in the Cloud w/ Puppet + Google Container Engine-...
Puppet
 
5 Things I Wish I Knew About Gitlab CI
Sebastian Witowski
 
SF JUG - GWT Can Help You Create Amazing Apps - 2009-10-13
Fred Sauer
 
Kubernetes - State of the Union (Q1-2016)
DoiT International
 
Adtech scala-performance-tuning-150323223738-conversion-gate01
Giridhar Addepalli
 
Adtech x Scala x Performance tuning
Yosuke Mizutani
 

More from Igalia (20)

PDF
Life of a Kernel Bug Fix
Igalia
 
PDF
Unlocking the Full Potential of WPE to Build a Successful Embedded Product
Igalia
 
PDF
Advancing WebDriver BiDi support in WebKit
Igalia
 
PDF
Jumping Over the Garden Wall - WPE WebKit on Android
Igalia
 
PDF
Collective Funding, Governance and Prioritiation of Browser Engine Projects
Igalia
 
PDF
Don't let your motivation go, save time with kworkflow
Igalia
 
PDF
Solving the world’s (localization) problems
Igalia
 
PDF
Nobody asks "How is JavaScript?"
Igalia
 
PDF
Getting more juice out from your Raspberry Pi GPU
Igalia
 
PDF
WebRTC support in WebKitGTK and WPEWebKit with GStreamer: Status update
Igalia
 
PDF
Demystifying Temporal: A Deep Dive into JavaScript New Temporal API
Igalia
 
PDF
CSS :has() Unlimited Power
Igalia
 
PDF
Device-Generated Commands in Vulkan
Igalia
 
PDF
Current state of Lavapipe: Mesa's software renderer for Vulkan
Igalia
 
PDF
Vulkan Video is Open: Application showcase
Igalia
 
PDF
Scheme on WebAssembly: It is happening!
Igalia
 
PDF
EBC - A new backend compiler for etnaviv
Igalia
 
PDF
RISC-V LLVM State of the Union
Igalia
 
PDF
Device-Generated Commands in Vulkan
Igalia
 
PDF
Downstream challenges
Igalia
 
Life of a Kernel Bug Fix
Igalia
 
Unlocking the Full Potential of WPE to Build a Successful Embedded Product
Igalia
 
Advancing WebDriver BiDi support in WebKit
Igalia
 
Jumping Over the Garden Wall - WPE WebKit on Android
Igalia
 
Collective Funding, Governance and Prioritiation of Browser Engine Projects
Igalia
 
Don't let your motivation go, save time with kworkflow
Igalia
 
Solving the world’s (localization) problems
Igalia
 
Nobody asks "How is JavaScript?"
Igalia
 
Getting more juice out from your Raspberry Pi GPU
Igalia
 
WebRTC support in WebKitGTK and WPEWebKit with GStreamer: Status update
Igalia
 
Demystifying Temporal: A Deep Dive into JavaScript New Temporal API
Igalia
 
CSS :has() Unlimited Power
Igalia
 
Device-Generated Commands in Vulkan
Igalia
 
Current state of Lavapipe: Mesa's software renderer for Vulkan
Igalia
 
Vulkan Video is Open: Application showcase
Igalia
 
Scheme on WebAssembly: It is happening!
Igalia
 
EBC - A new backend compiler for etnaviv
Igalia
 
RISC-V LLVM State of the Union
Igalia
 
Device-Generated Commands in Vulkan
Igalia
 
Downstream challenges
Igalia
 
Ad

Recently uploaded (20)

PPTX
AI Penetration Testing Essentials: A Cybersecurity Guide for 2025
defencerabbit Team
 
PDF
NewMind AI - Journal 100 Insights After The 100th Issue
NewMind AI
 
PDF
Reverse Engineering of Security Products: Developing an Advanced Microsoft De...
nwbxhhcyjv
 
PDF
"Beyond English: Navigating the Challenges of Building a Ukrainian-language R...
Fwdays
 
PDF
CIFDAQ Weekly Market Wrap for 11th July 2025
CIFDAQ
 
PDF
Using FME to Develop Self-Service CAD Applications for a Major UK Police Force
Safe Software
 
PPTX
Building Search Using OpenSearch: Limitations and Workarounds
Sease
 
PDF
HubSpot Main Hub: A Unified Growth Platform
Jaswinder Singh
 
PDF
[Newgen] NewgenONE Marvin Brochure 1.pdf
darshakparmar
 
PDF
From Code to Challenge: Crafting Skill-Based Games That Engage and Reward
aiyshauae
 
PPTX
AUTOMATION AND ROBOTICS IN PHARMA INDUSTRY.pptx
sameeraaabegumm
 
PPTX
UiPath Academic Alliance Educator Panels: Session 2 - Business Analyst Content
DianaGray10
 
PDF
The Builder’s Playbook - 2025 State of AI Report.pdf
jeroen339954
 
PDF
Fl Studio 24.2.2 Build 4597 Crack for Windows Free Download 2025
faizk77g
 
PDF
Bitcoin for Millennials podcast with Bram, Power Laws of Bitcoin
Stephen Perrenod
 
PDF
Building Real-Time Digital Twins with IBM Maximo & ArcGIS Indoors
Safe Software
 
PDF
Newgen 2022-Forrester Newgen TEI_13 05 2022-The-Total-Economic-Impact-Newgen-...
darshakparmar
 
PPTX
COMPARISON OF RASTER ANALYSIS TOOLS OF QGIS AND ARCGIS
Sharanya Sarkar
 
PDF
Smart Trailers 2025 Update with History and Overview
Paul Menig
 
PDF
Log-Based Anomaly Detection: Enhancing System Reliability with Machine Learning
Mohammed BEKKOUCHE
 
AI Penetration Testing Essentials: A Cybersecurity Guide for 2025
defencerabbit Team
 
NewMind AI - Journal 100 Insights After The 100th Issue
NewMind AI
 
Reverse Engineering of Security Products: Developing an Advanced Microsoft De...
nwbxhhcyjv
 
"Beyond English: Navigating the Challenges of Building a Ukrainian-language R...
Fwdays
 
CIFDAQ Weekly Market Wrap for 11th July 2025
CIFDAQ
 
Using FME to Develop Self-Service CAD Applications for a Major UK Police Force
Safe Software
 
Building Search Using OpenSearch: Limitations and Workarounds
Sease
 
HubSpot Main Hub: A Unified Growth Platform
Jaswinder Singh
 
[Newgen] NewgenONE Marvin Brochure 1.pdf
darshakparmar
 
From Code to Challenge: Crafting Skill-Based Games That Engage and Reward
aiyshauae
 
AUTOMATION AND ROBOTICS IN PHARMA INDUSTRY.pptx
sameeraaabegumm
 
UiPath Academic Alliance Educator Panels: Session 2 - Business Analyst Content
DianaGray10
 
The Builder’s Playbook - 2025 State of AI Report.pdf
jeroen339954
 
Fl Studio 24.2.2 Build 4597 Crack for Windows Free Download 2025
faizk77g
 
Bitcoin for Millennials podcast with Bram, Power Laws of Bitcoin
Stephen Perrenod
 
Building Real-Time Digital Twins with IBM Maximo & ArcGIS Indoors
Safe Software
 
Newgen 2022-Forrester Newgen TEI_13 05 2022-The-Total-Economic-Impact-Newgen-...
darshakparmar
 
COMPARISON OF RASTER ANALYSIS TOOLS OF QGIS AND ARCGIS
Sharanya Sarkar
 
Smart Trailers 2025 Update with History and Overview
Paul Menig
 
Log-Based Anomaly Detection: Enhancing System Reliability with Machine Learning
Mohammed BEKKOUCHE
 
Ad

The Whippet Embeddable Garbage Collection Library

  • 1. Whippet: A practical memory management upgrade for Guile & beyond 2 February 2025 – FOSDEM ’25 Andy Wingo Igalia, S.L.
  • 2. Agenda The big idea ❧ The results ❧ The future ❧
  • 3. The big idea Whippet is a practical memory management upgrade for Guile & beyond
  • 5. struct gc_options *options = NULL; struct gc_stack_addr *stack_base = NULL; struct gc_heap *heap; struct gc_mutator *mut; void *event_listener_data = NULL; gc_init(options, stack_addr, &heap, &mut, GC_NULL_EVENT_LISTENER, event_listener_data); void *obj = gc_allocate(mut, 42);
  • 6. options = gc_allocate_options(); gc_options_parse_and_set_many(options, getenv("GC_OPTIONS")); struct gc_mutator_roots roots; // Embedder-defined gc_mutator_set_roots(mut, &roots); // For generational configurations gc_write_barrier(mut, obj, obj_size, edge, new_val); // For cooperative safepoints gc_safepoint(mut); // For collectors that don't require copying gc_pin_object(mut, ref);
  • 7. static inline void gc_trace_object(struct gc_ref ref, void (*visit)(struct gc_edge edge, struct gc_heap *heap, void *visit_data), struct gc_heap *heap, void *trace_data, size_t *size) { /* ... */ } static inline void gc_trace_mutator_roots(struct gc_mutator_roots *roots, void (*trace_edge)(struct gc_edge edge, struct gc_heap *heap, void *trace_data), struct gc_heap *heap, void *trace_data) { /* ... */ }
  • 9. Whippet: An upgrade relative to BDW-GC Performance: Bump-pointer allocation, better parallelism Features: Ephemerons and finalizers that work Behavior: Choice of workload- appropriate collectors Memory use: Compaction, adaptive heap sizing (membalancer)
  • 10. Whippet: An upgrade with a migration path Bridge, n.: Construction with two ends and a path in between Whippet: a GC library with compile- time abstraction over embedder needs and collector construction Collector variants: MMC, PCC, BDW MMC collector has optional conservative tracing stack roots ❧ global roots ❧ (optionally) intra-heap edges ❧
  • 11. MMC Mostly-marking collector MMC = nofl space + lospace
  • 12. Nofl space “No free-list” For objects less than 8192 bytes Bump-pointer allocation Excellent parallelism Mostly-marking (Immix-derived), occasionally compacting 12% overhead Pinning (transitively due to conservative roots, or permanently) Optionally generational (sticky-mark)
  • 13. Lospace “Large object space” mmap allocation, freelist, deferred release Optionally generational (sticky-mark)
  • 14. Whippet: An upgrade relative to bespoke GCs Language run-times often get stuck with their GC Whippet’s compile-time API abstraction enables evolution
  • 15. PCC Parallel copying collector PCC = copy space + lospace
  • 16. Copy space For objects less than 8192 bytes Bump-pointer allocation Excellent parallelism Always compacting 100% overhead
  • 17. Generational PCC Generational PCC = copy space + copy space + lospace 2 MB nursery per processor active in last cycle 1 survivor cycle for copy space, 0 for lospace Field-logging write barrier Nursery memory range aligned, can be quick XOR check Still has 100% overhead
  • 18. BDW Boehm-Demers-Weiser collector Shim behind Whippet API Different safepoint behavior: not cooperative No support for gc_trace_object Not great parallelism Higher memory overhead than MMC
  • 19. A practical memory management upgrade for Guile & beyond Embed-only No dependencies C11 Hackable
  • 20. Practical testbench: Whiffle Scheme-to-C compiler: https:// github.com/wingo/whiffle Ensure Whippet offers appropriate API for embedders ❧ Allow more test cases to be written before moving to Guile ❧ Handles vs stack maps ❧ Main motivation was testing; shook out many bugs
  • 21. A practical memory management upgrade for Guile & beyond The pivot: Whippet API, but BDW collector ❧ MMC collector, with conservative roots ❧ Generational MMC collector (write barriers) ❧ Evacuating nursery? ❧ Shout-out to NLnet foundation for helping us with this work!
  • 22. A practical memory management upgrade for Guile & beyond WebAssembly+GC-to-C: Enable standalone Guile compilation via Hoot ? Ocaml, R, etc...
  • 23. Results: What do we win with Whippet? Strict throughput improvements: 20- 40% Access to smaller heap sizes: 30-50%
  • 28. Results: What do we learn with Whippet? Conservative root-finding is OK Generational GC is complicated, more tuning needed
  • 33. Future Guile, finally. This month!!! Your language run-time? Concurrent marking LXR-inspired reference counting of old generation?
  • 34. Try it out! https://github.com/wingo/whippet https://github.com/wingo/whiffle https://nlnet.nl/project/Whippet/ [email protected] Thanks!
  • 35. Attic
  • 36. New since 2023 PCC, generational PCC, precise field- logging write barriers instead of card marking, better parallelism, bug fixes, embeddability, finalizers, dynamic heap sizing (membalancer), less VMM traffic, whiffle, tests, nlnet, platform abstraction, options interface, extern space, stats, HDR histogram, renamings, nofl more eager