ZonePlus
ZonePlus copied to clipboard
`self.janitor:add(Janitor.new(), "destroy")` memory leaks
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)