Giter Site home page Giter Site logo

cppgc's People

Contributors

knizhnik avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Forkers

zcourts

cppgc's Issues

Two issues

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.

  1. 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.

  1. 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.

Have a question

Does it overload new/malloc?
If not, Can I use this project in a legacy code base with fewer code changes?

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.