Overview
| Artifact ID: | 0a165629c83abdb1c9f53e80e976c6b50fcecbb9 |
|---|---|
| Ticket: | 1ae12987cb21ae25cdb699d9c41d2596d8bd0035
Clean up history (::tcl::history) before/on exit (i.e., before exit handlers) |
| User & Date: | mr_calvin on 2016-10-21 14:37:03 |
Changes
- assignee changed to: "nobody"
- closer changed to: "nobody"
- cmimetype changed to: "text/plain"
- comment changed to:
The internal event storage of ::history (::tcl::history array) is not explicitly cleared when exiting (master interp, Tcl_Exit). Extensions' exit handlers, therefore, potentially see unbalanced refcounts on Tcl_Objs referenced from ::tcl::history. See for an example http://paste.tclers.tk/3973. Possible action items: - call [::history::clear] on Tcl_Exit (not only for interp teardown). - have [rename ::history {}] run the cleanup. Excerpt from the IRC discussion with dgp and dkf (): mr_calvin: (my main question basically is: why is an interactive tclsh not cleaning up the ::tcl::history at some early point during exit, before the exit handlers kick in.) <dgp> IIRC, [history] is coded mostly (entirely?) in Tcl? <dgp> And Tcl lacks good interface to exit handling. mr_calvin: yeah … library/history.tcl <dkf> Could just make Tcl_Main call [history clear] on the way out? <dgp> no <dkf> as handling all cases *very* hard <dgp> this cleanup would normally be handled by interp teardown <dgp> ....that [exit] does not tear down interps. <dkf> if you have something that needs to be freed, you need an exit handler and those REQUIRE the C API to set up dkf: as I wrote a little earlier. we do internal bookkeeping on Tcl_Objs intreps in NSF/NX, on exit, we draw the balance (exit handler) and references from tcl::history show up as unbalanced refcounts. <dkf> but effectively we *know* there are references retained unless you finalize mr_calvin: but doing a “unset -nocomplain ::tcl::history” in our exit handler would be one option (at least in our memdebug build) to balance those refcounts in time, wouldn’t it? <dkf> [::history clear] would leave me happier <dgp> Does [rename history {}] do a cleanup? <dkf> probably not <dgp> that would be a bug worth fixing. - foundin changed to: "core-8-6-branch"
- is_private changed to: "0"
- login: "mr_calvin"
- priority changed to: "5 Medium"
- private_contact changed to: "d4d1d8192a46acf2c7d58cddc1040ecdbc9c9d77"
- resolution changed to: "None"
- severity changed to: "Minor"
- status changed to: "Open"
- submitter changed to: "mr_calvin"
- subsystem changed to: "19. [history]"
- title changed to:
Clean up history (::tcl::history) before/on exit (i.e., before exit handlers)
- type changed to: "Bug"