LuaLanes / lanes

Lanes is a lightweight, native, lazy evaluating multithreading library for Lua 5.1 to 5.4.
Other
437 stars 94 forks source link

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

Closed xiaojieilli2016 closed 2 years ago

xiaojieilli2016 commented 2 years ago

--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?

benoit-germain commented 2 years ago

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.