Re: Lua and C++ memory
[
Date Prev][
Date Next][
Thread Prev][
Thread Next]
[
Date Index]
[
Thread Index]
- Subject: Re: Lua and C++ memory
 
- From: "Thomas Lefort" <thomas.lefort@...>
 
- Date: 2007年11月21日 21:42:36 +0100
 
On Nov 21, 2007 3:14 AM, Pixel Pusher <pixpush@gmail.com> wrote:
> I imagine that if no __gc metamethods is given to userdata, as you showed,
> the garbage collector never collects the "local" references to that class
> throughout the scripts, is that correct ?
Not correct, full userdata are collected even if they don't have a
__gc. Of course if your userdata holds external resources, you need to
define a __gc finalizer to release them after the userdata itself is
collected: http://www.lua.org/manual/5.1/manual.html#2.10.1
-- 
-- Thomas