[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: LuaThread leaks
- From: Diego Nehab <diego@...>
- Date: Wed, 23 Nov 2005 23:20:59 -0500 (EST)
In LuaThread, each thread's critical section creates in
lt_mutex(L) = (pthread_mutex_t *) malloc(pthread_mutex_sizeof());
But where it destroys? I have leaks for each created thread.
That's not really true. You have a leak for each lua_State that you
create directly from C and that you destroy with lua_close. All threads
created with thread.newthread actually share the same mutex. Unless you
create and destroy lots of lua_State's, you don't have leaks.
Lua 5.0.2 doesn't have a standard way to hook the lua_close. It has a
lua_userstateopen, but doesn't have a matching lua_userstateclose. Lua
5.1 addresses this problem.
I am about to release the final version of LuaThread for Lua 5.0.2. When
Lua 5.1 is out, I will release a new version that should have no leaks