knizhnik / cppgc Goto Github PK
View Code? Open in Web Editor NEWMark&sweep garbage collector for C++
License: Apache License 2.0
Mark&sweep garbage collector for C++
License: Apache License 2.0
According to mark_n_sweep_gc.txt
, these two are the disadvantages of reference counting. But I could not find the solution to them in mark-and-sweep GC.
- Noticeable performance penalty. Each manipulation with pointers requires update of counter.
In case of multithreaded application we have to use atomic operations or synchronization primitives to avoid race conditions.
Atomic operations are only required if one thread allocates an object and passes the reference to another. However, I noticed that the mark-and-sweep MemoryAllocator
is thread local, which cannot handle the shared references. If one thread A allocates an object O and passes the reference to another thread B, there are possibility that A does not hold the reference from root to O and deallocate it, while B still holds the reference. In order to handle this, all involed threads must be blocked before GC, and it brings performance penalty. Therefore, high performance GC in multi-thread context is not an easy thing.
- Deleting last reference to huge tree of objects can cause large number of cascade (recursive) deletes which can cause stack overflow.
However, in mark-and-sweep collector, marking last reference to huge tree of objects can cause large number of cascade (recursive) marks which can cause stack overflow. This is easy to solve through manual implemented stack.
Does it overload new/malloc?
If not, Can I use this project in a legacy code base with fewer code changes?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.