Skip to content
forked from Samsung/gcutil

Garbage collector for Escargot

Notifications You must be signed in to change notification settings

seungsoo47/gcutil

 
 

Repository files navigation

Garbage collector for Escargot

Based on 'Boehm-Demers-Weiser Garbage Collector'.

Terms

Roots

Generally roots mean pointers stored in statically allocated or stack allocated program variables.
A mark-sweep garbage collector traverses all reachable objects in the heap (more accurately it's gc heap in our case) by following pointers beginning with the roots.
In this project roots include followings,

  • (Add here)
  • (Add here)

Garbage-collected heap

(TODO)

(Add term here)

...

Coding guide

Interaction with the system malloc

It is usually best not to mix garbage-collected allocation with the system malloc-free. If you do, you need to be careful not to store pointers to the garbage-collected heap in memory allocated with the system malloc.

Using std::vector (1)

You need to be careful using std::vector since it allocates memory for its elements internally.
It allocates based on the allocator you pass in at construction. If you didn't specify one, you get the default allocator and it will allocate on the native heap!
So it is needed to specify GC allocator for the std::vector with elements that may have GC pointers.

To elaborate, at mark phase, GC start to scan pointer-like values and checks if the values belong to the GC heap. But if we allocate on the native heap using std allocator, the ranges are out of GC heap range, so GC ignores the values.

Using std::vector (2)

It is not recommended to use std::vector, because its std::vector::end points next space of the last element which makes GC think it as a non-collectable space! Please refer here.

(Add here)

About

Garbage collector for Escargot

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C 89.8%
  • C++ 4.6%
  • Makefile 3.0%
  • M4 1.9%
  • Roff 0.3%
  • CMake 0.2%
  • Other 0.2%