Code Monkey home page Code Monkey logo

gc's Introduction

Title : C++ PauseLess Garbage Collector

gc_ptr

gc_ptr is a full parallel garbage collector. It run with multi scan thread and one garbage collect thread. Unlike Mark And Sweep GC, It has no Stop The World side effect. Working thread don't need any sync with GC Thread. It base on a new GC algorithm. GC thread collect garbage object by running circle reference check continuously and don't interrupte work thread.

GC Algorithm

avatar

Each vertex has two counter. reference countor mark as r, circle counter mark as c. Traverse this graph, if it meet the same vertex, the circle counter increased. Above graph is result of Traversing start with A. Because A's reference count greater than circle counter, so A is alived. Next, we assigned pa to null. So A's reference count equal to circle as 2. In this case, we can't simply judge A is lose reference, because there is a extern reference on E, pointed by pb. In above graph, A, B, E, D form a circle reference. By using Graph Theory, A,B,E,D are consider as a strongly connected component. In this connected component, if one vertex has extern reference, all vertex shall be alived. We can get connected component by using Tarjan algorithm.But how to find extern reference vertex? It is simple. Just traverse each vertex in connected component, if there is one vertex which reference count minus circle count greater than 1, this vertex must have extern reference. Such as E, r - c = 2. In other side, if pa, pb all assigned to null. A,B,E,D have no extern reference. It can be considered as they are all garbage vertex, need to be release.

Tarjan algorithm

https://en.wikipedia.org/wiki/Tarjan%27s_strongly_connected_components_algorithm

gc's People

Contributors

yechaogithub avatar

Stargazers

 avatar zhonghua avatar glcolor avatar masx200 avatar  avatar gonggu avatar Jan Procházka avatar Lunkhopao Haokip avatar tengdecheng avatar HamiltonHuaji avatar Shepard Wang avatar 范义高 avatar Shaw_Zhang avatar zhllxt avatar templar1982 avatar SaltyZero avatar AG.王爱国 avatar Yan Li avatar bropasn avatar qianfengchen avatar TopMagic avatar ypcpy avatar  avatar YangJun avatar  avatar  avatar  avatar Yanjie He avatar DCode avatar Rafal avatar  avatar well.james avatar

Watchers

James Cloos avatar  avatar SaltyZero avatar  avatar 王子豪 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.