8000 GitHub - Yawning/odin-gc: Don't use this
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Yawning/odin-gc

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

odin-gc - Odin Garbage Collector

Yawning Angel (yawning at schwanenlied dot me)

This is a proof-of-concept garbage collector for the Odin language using the Boehm-Demers-Weiser conservative C/C++ Garbage Collector.

It currently requires Linux, and a copy of libgc, which is packaged by most distributions.

Usage

import gc "path/to/odin-gc`

main :: proc() {
    context = gc.init_context()

    // Do useful things:
    //
    // - You *can* use `free` and `delete`, if you really want to, but
    //   why bother?  Embrace the lazy.
    // - Do NOT use:
    //   - `core:dynlib.load_library`, use `gc.load_library` instead.
    //   - `core:thread`
    // - Avoid:
    //   - `base:runtime/heap_allocator`
    //   - `core:mem/virtual`
}

Limitations

  • It is a stop-the-world mark-and-sweep GC.
  • GC_init is used instead of GC_INIT.
  • gc.load_library must be used instead of core:dynlib/load_library
  • core:thread may appear to work, but it likely is broken.

Future Improvements

  • Add support for controlling GC behavior.
  • Add an allocator for "atomic" memory.
  • Add an allocator for "uncollectable" memory.
  • Work on supporting the things that are broken.

About

Don't use this

Resources

Stars

Watchers

Forks

Languages

0