[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: GC of external resources
- From: Glenn Maynard <glenn@...>
- Date: Fri, 1 Dec 2006 23:04:54 -0500
On Fri, Dec 01, 2006 at 10:40:18PM -0500, Diego Nehab wrote:
> __gc will only be executed when the garbage collector feels
> like it. This decision is based on how much memory
> the userdata itself takes (a few bytes). However, this userdata
> might be just a boxed pointer, pointing to a big hunk of external
> memory (say, a few megabytes).
I'm not aware of any priority given to freeing larger blocks of
data; as far as I know, it just scans over Lua allocations, and
as soon as it knows that an object is unused (and the GC cycle
ends, according to 2.10.1 "at the end ..."), it __gc's and frees
the object (and the rest of the objects to be freed that cycle).
I don't think there's any way to tell Lua to prioritize some
objects over others.
But, the garbage collector is pretty close to a black box as
far as the documentation is concerned. If there's a way to
hint the GC to make it more effective, I'd love to know about it.
Does this mean something? Some people sign their mails "thanks" or
"regards" or "good day". You're the first I've seen sign "boxes".