Giter Club home page Giter Club logo

destructors's People

Contributors

datzach avatar totobal5 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

destructors's Issues

Long chains and cycles

Because of how this detects GCed objects via weak references, it looks like there are a couple of possible ways that it could keep objects alive longer or even leak them:

Each step when dtor.update() runs, each object gets one chance to run its destructor(s). If an object holds a reference to another object, and its destructor also needs to use that object, then the GC can only collect the first object that frame- it's only possible to GC the second object after the destructor runs and its reference to the second object disappears.

For example: if you have a chain of N objects, each one and its destructor referencing the next, which the GC could ordinarily free all together, it will take N calls to dtor.update() for the whole thing to get cleaned up.

Or: if you have a cycle of these objects, the array of tracked DtorInstances will hold onto all of them, and the GC will never get a chance to start the process- all the weak refs will stay alive forever.

I haven't written enough GML from this era to know how common these patterns might be. It might be possible to improve the first case by repeating the loop in dtor.update() until it finds no more destructors to run, but OTOH that might re-introduce the problem the GC tries to solve by processing generations incrementally. I'm not sure whether it's possible to fix the second case with the existing API, either. So overall take this with a grain of salt!

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.