I have just compiled the latest fossil sources of both Tcl/Tk/My app,
using TCL_MEM_DEBUG for Tck & Tk (not my app).
But I get an abort when I start my application. The stack trace shows:
#0 0x00000039496330c5 in raise () from /lib64/libc.so.6
#1 0x0000003949634a76 in abort () from /lib64/libc.so.6
#2 0x00007ffff799f545 in Tcl_PanicVA (
format=0x7ffff7a19790 "expected to create new entry for object map",
argList=0x7fffffffd120) at /home/petasis/tcl/tcl/generic/tclPanic.c:115
#3 0x00007ffff799f60a in Tcl_Panic (
format=0x7ffff7a19790 "expected to create new entry for object map")
at /home/petasis/tcl/tcl/generic/tclPanic.c:144
#4 0x00007ffff799bb49 in TclDbInitNewObj (objPtr=0xc79758,
file=0x7ffff7a1d2ad "unknown", line=0)
at /home/petasis/tcl/tcl/generic/tclObj.c:1116
#5 0x00007ffff79b7818 in Tcl_DbNewStringObj (
bytes=0x7ffff0c8c85d "::CDM::CDM_Cache::LongTable", length=27,
file=0x7ffff7a1d2ad "unknown", line=0)
at /home/petasis/tcl/tcl/generic/tclStringObj.c:393
#6 0x00007ffff79b77aa in Tcl_NewStringObj (
bytes=0x7ffff0c8c85d "::CDM::CDM_Cache::LongTable", length=-1)
at /home/petasis/tcl/tcl/generic/tclStringObj.c:323
#7 0x00007ffff0c7004e in CDM_ObjectCache::ExposeCache (this=0xc9c4c8,
interp=0x605d18) at /home/petasis/Ellogon/CDM/CDM_MemoryCache.cpp:985
The code that seems to trigger this abort is:
LongTableObj = Tcl_NewStringObj("::CDM::CDM_Cache::LongTable", -1);
Tcl_IncrRefCount(LongTableObj);
if (Tcl_ObjSetVar2(interp, LongTableObj, ValObj,
CDM_NewLongObj(0), TCL_LEAVE_ERR_MSG) == NULL) return TCL_ERROR;
Tcl_DecrRefCount(LongTableObj);
It seems to happen inside Tcl_NewStringObj().
Any idea why this happens? Is there anything wrong with my code?
George
Did you recompile your extension / app components with these settings
as well? It may just be an incompatible interaction with the
(non-)debug mallocs in the core.
Jeff
No I haven't (the problem did go away after recompiling with
TCL_MEM_DEBUG also my code).
But I don't use malloc. Its a stubs-enabled extension, that uses only
Tcl_* functions. Why should I re-compile to use the Tcl_NewStringObj()
through stubs?
George
But "memory onexit filename" does not seem to generate "filename", when
the application exits. "memory objs filename" works though...
George
If you look at tcl.h, you will see that several of the key Tcl_New*
functions get alternate paths when built with TCL_MEM_DEBUG. The
current setup essentially requires that all extensions must recompile
to ensure the same init/free chain. I guess we need to improve the
docs on this "feature" to be more explicit about that.
Jeff