|
Functional-lang
0.0
An example functional programming language
|
Implements a tracing garbage collector. More...
#include <gc.hpp>
Public Member Functions | |
| bool | getMarkBit () const noexcept |
| std::size_t | getCountNewObjects () const noexcept |
| void | add (GCObj *obj) |
| Adds obj to all objects available. More... | |
| void | collect () |
| Collects garbage. More... | |
Implements a tracing garbage collector.
| void GCMain::add | ( | GCObj * | obj | ) |
Adds obj to all objects available.
| obj |
| void GCMain::collect | ( | ) |
Collects garbage.
Use mark function of directly reachable objects (roots). Resets getCountNewObjects to 0.
|
noexcept |
|
noexcept |
This is a 'hack'. Otherwise the algorithm would be force to reset the mark bit after every collect. But if a the markbit can be toggled (its switched the mark state after collecting), it becomes obsolete.
1.8.15