diff --git a/lsyncd.c b/lsyncd.c index f001724..6e6e4af 100644 --- a/lsyncd.c +++ b/lsyncd.c @@ -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 diff --git a/lsyncd.lua b/lsyncd.lua index 465a91b..9d4be23 100644 --- a/lsyncd.lua +++ b/lsyncd.lua @@ -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)()