Building a Copying GC for the Plush Programming Language
10 days ago
- #programming
- #garbage-collection
- #actor-model
- Plush is a dynamically-typed programming language inspired by Lox/JavaScript, designed for sound and graphics programming.
- The language features actor-based parallelism, simplifying multithreaded programming by avoiding locks and memory safety concerns.
- Plush's VM design includes a garbage collector to manage memory for messages sent between actors, ensuring dead objects are collected.
- Messages between actors are copied silently by the VM, avoiding the need for freezing or deep copying by the programmer.
- Each actor has two allocators: a private one for lock-free allocations and a mailbox allocator for receiving messages.
- A bump allocator and copying GC were implemented to keep memory allocation fast and simple.
- Collaboration with a friend helped overcome procrastination on GC implementation, leading to 90% completion in two weeks.
- A 3D animation demo runs at 60 FPS on an M1 MacBook Air, showcasing Plush's performance capabilities.
- Remaining GC improvements include handling full message allocators and optimizing performance for large collections.
- Contributors are sought to help profile performance issues and develop demo programs, including graphics and audio applications.