[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Garbage collecting in general
- From: Falko Poiker <fpoiker@...>
- Date: Wed, 21 Feb 2001 18:26:33 -0800
Maybe I'm just doing something wrong, or I don't get it. I'll try to be as
clear as possible.
I have a lua userdata type called "selection" that is a mirror of a
selection class we have in our game. This lua type has a garbage collection
tag method defined for it that deletes a selection instance in the game (the
one being pointed to by the userdata object).
Our game runs a lua file to read in a series of lua functions (which define
different portions of an AI state machine), then calls these lua functions
as needed. In these functions local variables are created of the type
selection (globals as well, but we'll ignore that for now). I was under the
impression that lua, having a garbage collection system, would at some point
gc these variables automatically, and as a result call the gc tag method
which would delete the selection instance in the game. This does not
happen. At no point does the gc tag method get called for any of the
selections created in lua, even when the state is closed. I even took lhf's
advice and forced garbage collection, but even doing this didn't trigger the
gc tag method, nor the deletion of these selection instances.
Why is garbage collection not working for me? Am I doing something
fundamentally wrong here?
Any help would be appreciated.