[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Why for lua_gc no option "LUA_GCCOLLECTFULL"?
- From: bil til <biltil52@...>
- Date: Wed, 9 Nov 2022 15:07:20 +0100
Hi,
I would like to offer my Lua users a way to check the "used RAM
memory" for my "Low RAM" applications (RAM ca. 60kB).
I have give my own alloc function to Lua which checks every free and
alloc and always updates an integer iBytesAlloc... . This is the
consumed memory in unit bytes.
If the user wants to know the "used RAM memory", it is necessary to do
a full garbage collect, this would be the internal Lua function
luaC_fullgc(L, 1) (with 2nd parameter "1", showing "emergency
collect").
... I would prefer to use lua_gc for this, but lua_gc(LUA_GCCOLLECT)
would only invoke luaC_fullgc( L, 0)... .
Is it safe, that I invoke luaC_fullgc( L, 1) in my C software? Or are
there possible pitfalls (why can I not invoke e. g.
lua_gc(LUA_GCCOLLECTFULL)? - this would be nicer from my point of
view...).