LuaLanes / lanes

Lanes is a lightweight, native, lazy evaluating multithreading library for Lua 5.1 to 5.4.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Each treADS created increases memory and cannot be freed by lua_close(L) after completion

xiaojieilli2016 opened this issue · comments

--luatest.lua
local lanes = require "lanes".configure( {with_timers=false} )
local linda = lanes.linda()
f = lanes.gen( function( n) return 2 * n end)
a1 = f( 1) --Increase the memory
a 2= f( 1) --Increase the memory
a 3= f( 1) --Increase the memory

Call luatest. Lua using the Lua C API
lua_State *L = luaL_newstate();
luaL_openlibs(L);
luaL_dofile(L, "luatest.lua");
lua_close(L)

Memory cannot be freed without exiting the program. Why?

I have done some tests by replacing the allocator and keeping trace of all allocations. As far as I can tell, Lanes itself and Lua don't leak anything. I do observe that the process memory usage increases when launching more states (tested under windows 10), but that does not seem to be related to Lanes or Lua, so there isn't really anything I can do about it.