lua-users home
lua-l archive

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


Roberto Ierusalimschy <roberto@inf.puc-rio.br> 于2023年10月20日周五 21:50写道:

> However, if we introduce a callback, it probably would also need a user
> data to be passed to the callback. So, each external string would need
> three pointers of overhead. That could be significant for "short" long
> strings (such as in the range 40~100 bytes).
>

I think a global callback would be OK. For example, using the
metamethod __gc of the string type.
Only external string trigger it.

The callback is not used for releasing, it just report  the C pointer
to host program.

-- 
http://blog.codingnow.com