--   This file is part of Reno desktop.
--
--  Reno desktop is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
--
--  Reno desktop is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
--
--  You should have received a copy of the GNU General Public License along with Reno desktop. If not, see <https://www.gnu.org/licenses/>. 
--  garbage collection timer
local gears = require("gears")
gears.timer {
    timeout = 30,
    autostart = true,
    callback = function()
        local out_string = tostring(os.date()) .. "\nLua memory usage:"..tostring(collectgarbage("count")).."\n"
        collectgarbage()
        out_string = out_string .. "\nLua memory usage after GC: "..tostring(collectgarbage("count")).."\n"
        out_string = out_string.."Objects alive:"
        for name, obj in pairs{button = button, client = client, drawable = drawable, drawin = drawin, key = key, screen = screen, tag = tag } do
            out_string = out_string .. "\n" .. tostring(name) .. " = "..tostring(obj.instances())
        end
    end
}
