lua-users home
lua-l archive

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


Hi,

 

I’ve been made aware of the problem a while back but I absolutely don’t have time to investigate at the moment. Also, I don’t have any special knowledge of the code besides the fixes I submitted which eventually got me to become the project’s maintainer J. Is this something that you observed with previous versions (say, 2.0.3) or did it appear with 2.0.6 ?

 

De : lua-l-bounces@lists.lua.org [mailto:lua-l-bounces@lists.lua.org] De la part de Fredrik Widlund
Envoyé : vendredi 1 octobre 2010 12:00
À : lua-l@lists.lua.org
Objet : Lua lanes (possibly) leaking memory

 

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