[Tutor] Object attributes surviving deletion
jeff at drinktomi.com
Fri Jun 27 00:32:23 CEST 2008
On Jun 26, 2008, at 2:59 PM, Shrutarshi Basu wrote:
> (self.xOrigin, self.yOrigin), self.rows, self.columns, gram,
> As you can see, not only do I delete gram, I also blank out everything
> that should be cleared. I have to manually clear gram.database because
> otherwise it keeps the data from previous calls to that function. I
> don't understand why this should be. DisplayModule is a class that
> packages and organizes the data into a convenient form.
You've passed gram to DisplayModule, and you've added DisplayModule
to a collection. My guess is that display module still holds a
reference to gram,
and gram won't be collected until DisplayModule clears that reference.
As an additional aside python doesn't guarantee that objects will
be released as soon as they are unreachable. They can hang
around for a while until a garbage collection is triggered.
More information about the Tutor