mirror of
https://github.com/octoleo/lsyncd.git
synced 2024-12-12 14:17:47 +00:00
fixing memory leak
This commit is contained in:
parent
d6688fc8ab
commit
e34c182b9f
4
lsyncd.c
4
lsyncd.c
@ -1502,6 +1502,10 @@ masterloop(lua_State *L)
|
|||||||
clock_t now = times(dummy_tms);
|
clock_t now = times(dummy_tms);
|
||||||
clock_t alarm_time = 0;
|
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
|
// queries runner about soonest alarm
|
||||||
load_runner_func(L, "getAlarm");
|
load_runner_func(L, "getAlarm");
|
||||||
if (lua_pcall(L, 0, 1, -2)) exit(-1); // ERRNO
|
if (lua_pcall(L, 0, 1, -2)) exit(-1); // ERRNO
|
||||||
|
12
lsyncd.lua
12
lsyncd.lua
@ -221,7 +221,7 @@ Queue = (function()
|
|||||||
end
|
end
|
||||||
|
|
||||||
-----
|
-----
|
||||||
-- Stateless queue iterator.
|
-- Queue iterator (stateless)
|
||||||
--
|
--
|
||||||
local function iter(list, pos)
|
local function iter(list, pos)
|
||||||
pos = pos + 1
|
pos = pos + 1
|
||||||
@ -235,7 +235,8 @@ Queue = (function()
|
|||||||
end
|
end
|
||||||
|
|
||||||
-----
|
-----
|
||||||
-- Stateless reverse queue iterator.
|
-- Reverse queue iterator. (stateless)
|
||||||
|
--
|
||||||
local function iterReverse(list, pos)
|
local function iterReverse(list, pos)
|
||||||
pos = pos - 1
|
pos = pos - 1
|
||||||
while list[pos] == nil and pos >= list.first do
|
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
|
-- table to receive the sync of an event or event list
|
||||||
local e2s = {}
|
local e2s = {}
|
||||||
-- dont stop the garbage collector to remove entries.
|
-- dont stop the garbage collector to remove entries.
|
||||||
setmetatable(e2d, { __mode = 'k' })
|
setmetatable(e2d, { __mode = 'v' })
|
||||||
setmetatable(e2s, { __mode = 'k' })
|
setmetatable(e2s, { __mode = 'kv' })
|
||||||
|
|
||||||
-----
|
-----
|
||||||
-- removes the trailing slash from a path
|
-- removes the trailing slash from a path
|
||||||
@ -1815,7 +1816,6 @@ local Inotify = (function()
|
|||||||
local wd = pathwds[path]
|
local wd = pathwds[path]
|
||||||
if not wd then return end
|
if not wd then return end
|
||||||
if core then lsyncd.inotify.rmwatch(wd) end
|
if core then lsyncd.inotify.rmwatch(wd) end
|
||||||
|
|
||||||
wdpaths[wd] = nil
|
wdpaths[wd] = nil
|
||||||
pathwds[path] = nil
|
pathwds[path] = nil
|
||||||
end
|
end
|
||||||
@ -1970,7 +1970,7 @@ local Inotify = (function()
|
|||||||
return {
|
return {
|
||||||
addSync = addSync,
|
addSync = addSync,
|
||||||
event = event,
|
event = event,
|
||||||
statusReport = statusReport
|
statusReport = statusReport,
|
||||||
}
|
}
|
||||||
end)()
|
end)()
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user