Overview
| Artifact ID: | e101f534208b4f6ab861059b8982ccc4d17386b4 |
|---|---|
| Ticket: | 2919042fffffffffffffffffffffffffffffffff
Exit reform lost valgrindability |
| User & Date: | ferrieux on 2009-12-22 21:24:52 |
Changes
- icomment:
OK, proceeding anyway. The attached 'val2' patch is a superset of the previous one; in addition, it establishes an exit handler to call FreeMainInterp, a new routine doing the final DeleteInterp+Release+SetStartupScript(NULL,NULL). The existing TclInExit() MODULE_SCOPE-visible predicate is used to disable several panics from the running interpreter (solving the Muenchhausen effect). With this patch, and the TCL_FINALIZE_ON_EXIT variable set, valgrind shows two interesting things (valgring --leak-check==full ./tclsh /dev/null): (1) a few bytes are leaked due to the active bytecode and stack frames being left over (associated with a suppressed panic complaining about them). (2) several big blocks of TclAllocateFreeObjects's (2400 bytes) are leaked. Of course, (1) is expected, pending dedicated work for cleaning up the running interp. No big deal. However, (2) is funny in the light of the following comment in TclAllocateFreeObjects: * This has been noted by Purify to be a potential leak. The problem is * that Tcl, when not TCL_MEM_DEBUG compiled, keeps around all allocated * Tcl_Obj's, pointed to by tclFreeObjList, when freed instead of actually * freeing the memory. TclFinalizeObjects() does not ckfree() this memory, * but leaves it to Tcl's memory subsystem finalization to release it. * Purify apparently can't figure that out, and fires a false alarm. It is funny, because there is no mystery. Purify is not at fault. It just turns out that in the default -DTCL_ALLOC=0 -UTCL_MEM_DEBUG used in unix, those blocks are simply malloc'ed with no linking or external referencing. Another proof of that is that in that case, TclFinalizeMemorySubsystem is an empty function ! Of course this merits another bugreport; in the meantime please validate the approach of the current patch. - login: "ferrieux"
- mimetype: "text/plain"
- username: "ferrieux"