Overview
| Artifact ID: | 4b601f5cd29d32b7c997dae50cf33cd5fdcae4b7 |
|---|---|
| Ticket: | 218075ffffffffffffffffffffffffffffffffff
Interpreter Associated data delete proc not called when tcls |
| User & Date: | dgp on 2006-06-10 02:48:37 |
Changes
- closedate changed to: "2006-06-09T19:48:37"
- closer changed to: "dgp"
- icomment:
Logged In: YES user_id=80530 I made an attempt to create a patch that implements this feature request and discovered why it won't mesh with Tcl's design. The logic that controls the destruction of a Tcl_Interp is to defer the teardown of the interp (including all the callbacks that clean up assocdata and that tend to command deletion issues), until all "active evals" in the interp have fully unwound. Probably the most frequent way Tcl_Exit() gets called is via the evaluation of the [exit] command. When [exit] is getting evaluated, the interp is busy, so none of its cleanup is going to be done anyway. This means the only way to be sure an important bit of cleanup of assocdata (subject of this report) gets done is to use both the "delProc" argument to Tcl_SetAssocData() to handle cleanup in the case that an interp gets deleted before process finalization, and also to use Tcl_Create(Thread)ExitHandler() to register a cleanup callback to handle cleanup during process finalization. The two cleanup routes need to be aware of each other as well so they don't both fire, or if they do both fire, they can handle any possible state. Note that some types of cleanup that are important in the interp deletion case (like memory free-ing to avoid memory leaks) need not be handled at process finalization time, when the OS will do the relevant cleanup anyway.
- login: "dgp"
- mimetype: "text/plain"
- resolution changed to: "Rejected"
- status changed to: "Closed"
- username: "dgp"