lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Yep. 1st calls gc method, 2nd frees the ud.

Iirc there is an exception with os.exit() that might cause the gc method not being called.

Thijs

Marc Balmer <marc@msys.ch> schreef:
The 5.1 refrence manual says about garbage collecting userdata:

"At the end of each garbage-collection cycle, the finalizers for
userdata are called in reverse order of their creation, among those
collected in that cycle. That is, the first finalizer to be called is
the one associated with the userdata created last in the program. The
userdata itself is freed only in the next garbage-collection cycle. "

But this does not imply that the __gc field is called twice, right?
I.e. the __gc field of any userdata value is called exactly only once,
is that correct?

Thanks,
Marc