Git Product home page Git Product logo

auto-cc's Introduction

auto-cc

A small utility to perform automatic cycle collections on bacon_rajan_cc objects when necessary.

This is intended for scenarios where precisely controlling the shape of data structures is impractical or impossible, and large numbers of cycles are likely to happen outside of the programmer's control such as values in a VM/interpreter for a scripting language implementation.

The logic for checking and collecting roots is only contained in the cc function (calling Cc::new() as per usual will not trigger the check).

Cc::new() should be preferred for short-lived code, or code where little to no cycles are likely to be created.

It is important to note that cycles are collected before a new Cc<T> is allocated, so it is possible that a dead cycle could still remain after the untrusted code has finished execution, and a manual call to the collect_cycles function from the bacon_rajan_cc crate to perform final cleanup is recommended.

Basic Example

extern crate auto_cc;

use auto_cc::{
    cc,
    
    bacon_rajan_cc::{
        Cc,

        collect_cycles, // for final cleanup, when necessary
    }
};

fn main() {
    let _x: Cc<u8> = cc( 0 );
}

auto-cc's People

Contributors

sirtony avatar

Stargazers

 avatar

Watchers

James Cloos 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.