Skip to content
Snippets Groups Projects
Commit 2c351664 authored by Vladimir Davydov's avatar Vladimir Davydov
Browse files

Revert "lua: fix tuple cdata collecting"

This reverts commit 022a3c50.

According to FFI documentation [1], ffi.cast() creates a new object for
the given type and initializes it with the given value. So setting a
finalizer for a tuple before casting it to const_tuple_ref_t is totally
wrong as it allows the Lua interpreter to invoke the finalizer as soon
as the cast is complete. That said, we must revert the commit that
swapped ffi.cast and ffi.gc order in tuple_bless() and reopen the issue
it intended to fix - see #3751 - no wonder it improved the garbage
collector performance as it basically made all tuples collectable right
from the moment they are blessed.

To make sure we won't step on the same issue again in future, let's also
add a relevant test case.

[1] http://luajit.org/ext_ffi_api.html

Closes #3902
parent 78957d85
No related branches found
No related tags found
No related merge requests found
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment