Skip to content

self.janitor:add(Janitor.new(), "destroy") memory leaks #83

@wrello

Description

@wrello

Occurences of:

self.janitor:add(Janitor.new(), "destroy")

are memory leaks if once the inner janitor is destroyed it doesn't get removed from the outer janitor.

They need the following pattern:

local janitor, objectIndex = self.janitor:add(Janitor.new(), "destroy")
janitor:add(function()
    self.janitor:remove(objectIndex)
end)

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