[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Re: Re: Help ! A problem with the memroy
- From: "Aurora" <bravefly@...>
- Date: Tue, 13 Apr 2010 10:35:50 +0800
Dear Wu Hao,
Thanks , But http://www.lua.org/pil/14.3.html. "Page not found"
------------------
Aurora
2010-04-13
-------------------------------------------------------------
From:Hao Wu
Date:2010-04-13 10:25:57
To:Lua list
CC:
Subject:Re: Re: Re: Help ! A problem with the memroy
check this out, http://www.lua.org/pil/14.3.html. hope it help
hao
On Mon, Apr 12, 2010 at 10:17 PM, Aurora <bravefly@gmail.com> wrote:
> Dear Patrick,
>
> lua_settop(L, 0);
> lua_newtable(L);
> lua_replace(L, LUA_GLOBALSINDEX);
> lua_pushvalue(L, LUA_GLOBALSINDEX);
> lua_replace(L, LUA_ENVIRONINDEX);
> lua_newtable(L);
> lua_replace(L, LUA_REGISTRYINDEX);
> lua_gc(L, LUA_GCCOLLECT, 0);
>
> Your code just create new empty tables, replace the GT and registry
> with them. This will destroy the base library & my extension what loaded
> by luaI_openlib .
>
> ------------------
> Aurora
> 2010-04-13
>
> -------------------------------------------------------------
> From:Patrick Donnelly
> Date:2010-04-13 10:09:28
> To:Lua list
> CC:
> Subject:Re: Re: Help ! A problem with the memroy
>
> On Mon, Apr 12, 2010 at 10:00 PM, Aurora <bravefly@gmail.com> wrote:
>> Dear Sam,
>>
>> "Possibly, it's because the last file created global vars, and the gc
>> doesn't know that they will never be used again. "
>>
>> That's it. You are so bright.
>> The method you give is ok. But I need to do it in the C source code of lua, not in lua.
>> I want to know how could I delete all the objects and memory produced by the last lua file.
>> such as:
>> luaF_close(L, L->top);
>> free_reg_table(L, h);
>> free_global_table(L, h);
>> free_all_rootgc(L, h);
>> free_all_str(L, h);
>
>
> /* From main Lua state */
> lua_settop(L, 0);
> lua_newtable(L);
> lua_replace(L, LUA_GLOBALSINDEX);
> lua_pushvalue(L, LUA_GLOBALSINDEX);
> lua_replace(L, LUA_ENVIRONINDEX);
> lua_newtable(L);
> lua_replace(L, LUA_REGISTRYINDEX);
> lua_gc(L, LUA_GCCOLLECT, 0);
>
>
> --
> - Patrick Donnelly
>