[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: RE: Lua lanes (possibly) leaking memory
- From: Fredrik Widlund <fredrik.widlund@...>
- Date: Fri, 1 Oct 2010 13:50:28 +0200
Yes, I'm testing this now and it seems much more stable. I've also tried to let lanes "loose" using lanes.gen(function() ... end)(), but this does not seem to work and memory increases.
I don't want to do a blocking wait, but I guess I can check the lanes for status and collect the results when they are finished without blocking.
Great help, guys! Thanks a lot, this should help me.
However letting lanes "loose" still seems to be a problem, i.e.
local linda = lanes.linda()
lanes.timer(linda, "timer", 0, 0.01)
while true do
local time, message = linda:receive("timer")
lanes.gen(function () return 0 end)(lanes, lanes, lanes, lanes, x)
end
Kind regards,
Fredrik Widlund
-----Original Message-----
From: lua-l-bounces@lists.lua.org [mailto:lua-l-bounces@lists.lua.org] On Behalf Of Benoit Germain
Sent: den 1 oktober 2010 13:31
To: Lua mailing list
Subject: RE: Lua lanes (possibly) leaking memory
> 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.
After a bit of examining your sample, I've changed it as follows:
require "lanes"
function sensor(x)
return x
end
local x = 0
local linda = lanes.linda()
lanes.timer(linda, "timer", 1, 0.01)
local lane = lanes.gen("*", sensor)
while true do
local time, message = linda:receive("timer")
local lane_h = lane(time)
-- local result = lane_h[1]
x = x + 1
end
Note that I've commented out the line
local result = lane_h[1]
Meaning that I don't read the result in the lane object. Running the script indeed shows a memory usage growth. If I uncomment the line, memory usage becomes stable. I think that since you never join the lanes, either with lane_h:join(), nor by reading the values, you just create a host of "free running lanes" that run outside control of the Lua main thread.