Important question about garbage collection

From: Andrew Joseph Kompanek <>
Date: Thu, 8 Dec 1994 05:29:02 -0500 (EST)

I have a question about widget destruction and garbage collection, in
particular w.r.t. to top level windows.

Suppose I want to create a new top-level window within a lambda closure
that's acting as a tk event handler callback.

If I bind it to a local variable inside the lambda closure do I risk having
the top-level being garbage collected?

In addition, if I create, say several buttons, within the initialization
function for a dialog box class of my own creation, do I need to bind
the created STklos widget classes to slots within that dialog box
(or somewhere else) to prevent garbage collection. Or will the TK
widgets stick around on the Tk side?

I guess my question is, in general, do you need to make sure that any
widget is associated with the global environment in some way? Or can
you create "local" widgets?

It seems that this is probably the case... I have some code which
intermittently causes problems (actually it seg faults when I try
to create a new top level window from within a lambda closure callback).

Is there any way to turn of garbage collection is a temporary measure
before I fix everything properly?

Received on Thu Dec 08 1994 - 11:31:31 CET

This archive was generated by hypermail 2.3.0 : Mon Jul 21 2014 - 19:38:59 CEST