GithubHelp home page GithubHelp logo

Any pointers on an ARC design? about astro HOT 4 CLOSED

astrolang avatar astrolang commented on August 23, 2024
Any pointers on an ARC design?

from astro.

Comments (4)

appcypher avatar appcypher commented on August 23, 2024

There may be papers out there that explain this technique, but I'm not aware of any of them. Its just something I thought of and started implementing.

I like calling it Automatic Reference Journalling cos it does more than just counting references.
I've tested it on some simple programs and it worked quite well, however since I've not tried it on more complex programs, I can't claim that it will always work in all cases. I have a strong feeling it will though.

The problem with the method now is that it does deep analysis of each object which might hurt compile time, but then I've not spent enough time with it to optimize it.

from astro.

appcypher avatar appcypher commented on August 23, 2024

I'm closing this issue. I believe I've provided answer to the question asked.

from astro.

MaxGraey avatar MaxGraey commented on August 23, 2024

Hi, I have another question about ARC implementation.

How you resolve cyclic references which cause to memory leak without special hints? For example Objective-C/Swift use special week references define like:

@property (nonatomic, weak) NSObject* a;

Rust provide much wider patterns to resolve this like RefCell, Weak, and Rc.

Some languages like Alef/Limbo has ARC with fallback to GC for resolving this case.
Someone use cyclic reference counter (CRC)

So which way will you choose?

from astro.

appcypher avatar appcypher commented on August 23, 2024

Sorry, I got this late.

The ARC method I'm employing is not like Objective-C/Swift, nor like Alef/Limbo ARC-tracing hybrid.
I've tried looking for papers that explain the method I'm using and these papers come close:

• Detlefs, D. (2004). Automatic Inference of Reference-Count Invariants.
• Goldberg, B., & Park, Y.G. (1991). Reference Escape Analysis: Optimizing Reference Counting based on the Lifetime of References. PEPM.
• Joisha, P.G. (2008). A principled approach to nondeferred reference-counting garbage collection. VEE.

But none of them goes into details of how this can be extended to concurrent programs, which is the same caveat mine has.

For non-concurrent programs, objects can be freed deterministically without any runtime cost apart from calling free.

In concurrent programs, the system falls apart since an async function may free an object in use by another async function after it exits.

The exit order of invoked async functions can be unpredictable, so some sort of runtime synchronization is needed to handle that.

You may need to take a look at the first paper I linked, it describes my method well.
Maybe I will create time to explain what I have in mind later.

from astro.

Related Issues (12)

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.