lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Hi,

 

We’re having a memory leakage problem with Lua and Lanes. We running a daemon written in Lua that spawns a lane every second to measure availability. What we’re seeing is a growing memory footprint that the garbage collector doesn’t seem to be handling. After a couple of days the usage has grown from around 100M initially to 1GB, and keeps growing.

 

It seems to be related to the spawning of lanes.

 

Reproduce (in accelerated simplified form):

function sensor(x)
end

function main(arg)
local sensors = {}
local x = 0
local linda = lanes.linda()
lanes.timer(linda, "timer", 0, 0.02)
local lane = lanes.gen("*", sensor)
while true do
local time, message = linda:receive("timer")
sensors[x] = lane(x)
x = x + 1
end
end

The problem grows when you add arguments to the lane, i.e.

sensors[x] = lane(lanes, lanes, lanes, lanes, lanes, lanes, x) increases the memory growth.

 

Are we doing anything wrong, is this a known problem, and do you have any ideas how we could work around this?

 

Kind regards,

Fredrik Widlund