Skip to content

Interaction with garbage collector? #6

Open
@MilesCranmer

Description

@MilesCranmer

I'm wondering if the various macros should interact with Julia's GC at all. For example, the Lifetime object is actually aware of all the references created in its scope:

mutable struct Lifetime
    const immutable_refs::Vector{Any}
    const immutables_lock::Threads.SpinLock
    const mutable_refs::Vector{Any}
    const mutables_lock::Threads.SpinLock
    @atomic expired::Bool

    Lifetime() = new([], Threads.SpinLock(), [], Threads.SpinLock(), false)
end

and so when cleanup!(lifetime) is called, it could call the finalizers automatically. Which would be very rust-like.

But I'm not sure if this is the direction we want to go because I'm not expecting the borrow checker code to ever be faster than plain Julia. Not sure though.

@MasonProtter do you know if the compiler escape analysis tools will ever be used to free objects without needing the garbage collector? In other words, get more rust-style memory management?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions