fixing memory leak

This commit is contained in:
Axel Kittenberger 2012-03-16 16:05:16 +01:00
parent d6688fc8ab
commit e34c182b9f
2 changed files with 10 additions and 6 deletions

View File

@ -1502,6 +1502,10 @@ masterloop(lua_State *L)
clock_t now = times(dummy_tms);
clock_t alarm_time = 0;
// memory usage debugging
// lua_gc(L, LUA_GCCOLLECT, 0);
// printf("gccount: %d\n", lua_gc(L, LUA_GCCOUNT, 0) * 1024 + lua_gc(L, LUA_GCCOUNTB, 0));
// queries runner about soonest alarm
load_runner_func(L, "getAlarm");
if (lua_pcall(L, 0, 1, -2)) exit(-1); // ERRNO

View File

@ -221,7 +221,7 @@ Queue = (function()
end
-----
-- Stateless queue iterator.
-- Queue iterator (stateless)
--
local function iter(list, pos)
pos = pos + 1
@ -235,7 +235,8 @@ Queue = (function()
end
-----
-- Stateless reverse queue iterator.
-- Reverse queue iterator. (stateless)
--
local function iterReverse(list, pos)
pos = pos - 1
while list[pos] == nil and pos >= list.first do
@ -525,8 +526,8 @@ local InletFactory = (function()
-- table to receive the sync of an event or event list
local e2s = {}
-- dont stop the garbage collector to remove entries.
setmetatable(e2d, { __mode = 'k' })
setmetatable(e2s, { __mode = 'k' })
setmetatable(e2d, { __mode = 'v' })
setmetatable(e2s, { __mode = 'kv' })
-----
-- removes the trailing slash from a path
@ -1815,7 +1816,6 @@ local Inotify = (function()
local wd = pathwds[path]
if not wd then return end
if core then lsyncd.inotify.rmwatch(wd) end
wdpaths[wd] = nil
pathwds[path] = nil
end
@ -1970,7 +1970,7 @@ local Inotify = (function()
return {
addSync = addSync,
event = event,
statusReport = statusReport
statusReport = statusReport,
}
end)()