Does the full userdata __gc metamethod need to free () its memory?

I have full user information in a Lua module written in C. User data has a __gc()metamethod that is called by the garbage collector. Does lua interpreter provide free user data memory after the call, __gc()or do I need it free()internally __gc()?

+3
source share
1 answer

You should not free memory since you are not malloc (); Lua does both. In fact, memory is not even collected in the same garbage collection cycle as described in section 2.10.1 in the Lua 5.1 reference manual .

+8
source

Source: https://habr.com/ru/post/1698510/


All Articles