Index: TODO =================================================================== diff -u -r0946e13d87bd5400bf785f35f6691ecb538d5566 -r6adee09c9a76dce3a29782d40c04d0ae7e01664d --- TODO (.../TODO) (revision 0946e13d87bd5400bf785f35f6691ecb538d5566) +++ TODO (.../TODO) (revision 6adee09c9a76dce3a29782d40c04d0ae7e01664d) @@ -3117,19 +3117,35 @@ with 0-refCount to ease debugging * added explicit names for refcounting for "paramDefsObj" * added explicit names for refcounting for "freeList" (for forwaders) + * provide debug-refcounts for "NSNamespace" + * provide debug-refcounts for "nextArgumentVector" - TODO: - from parameters.test - # TODO: currently, we need to converter (or a converter on nx::Slot), since + # TODO: currently, we need two converters (or a converter on nx::Slot), since # variable uses nsf::is and attribute uses the slot obj. method variable should # be changed to use the slotobj as well. - disposition.test: * remove/check exit (see comments in the file) * handle exit from eval/inticmd with proper refcounts + - check ckalloc/ckfree, whether these should be moved to + NEW/FREE. + - nsf-refcounts on TclNamespace are not correct, when namespaces + are deleted by tcl. Maybe this is not a problem, but we have to check. + Test case explicit-namespace-free { + Object create o {:method foo {} {return 1}} + namespace delete ::o + } + - fix mem_count on alias.test (currently 1) and destroy.test (-2), + most probably related with the point above + - fix mem_count on testx (currently 3) + - fix mem_count on contains.test (currently 3) + - fix mem_count on slottest.test (currently 4) + - fix mem_count on xocomm.test (currently 26) + - add "delete variable" analogous to "delete attribute" - interface of "variable" and "attribute": * add switch -array for "variable"? Index: generic/nsf.c =================================================================== diff -u -r0946e13d87bd5400bf785f35f6691ecb538d5566 -r6adee09c9a76dce3a29782d40c04d0ae7e01664d --- generic/nsf.c (.../nsf.c) (revision 0946e13d87bd5400bf785f35f6691ecb538d5566) +++ generic/nsf.c (.../nsf.c) (revision 6adee09c9a76dce3a29782d40c04d0ae7e01664d) @@ -745,8 +745,8 @@ static void NsfCommandRelease(Tcl_Command cmd) { /*fprintf(stderr,"NsfCommandRelease %p\n", cmd);*/ - TclCleanupCommandMacro((Command *)cmd); MEM_COUNT_FREE("command.refCount", cmd); + TclCleanupCommandMacro((Command *)cmd); } /*********************************************************************** @@ -3009,7 +3009,7 @@ #if defined(VAR_RESOLVER_TRACE) int flags = var ? ((Var *)var)->flags : 0; fprintf(stderr,"CompiledColonVarFetch var '%s' var %p flags = %.4x dead? %.4x\n", - ObjStr(resVarInfo->nameObj), var, flags, flags&VAR_DEAD_HASH); + ObjStr(resVarInfo->nameObj), var, flags, flags & VAR_DEAD_HASH); #endif /* @@ -3581,6 +3581,7 @@ static void NSNamespacePreserve(Tcl_Namespace *nsPtr) { assert(nsPtr); + MEM_COUNT_ALLOC("NSNamespace", nsPtr); Tcl_Namespace_refCount(nsPtr)++; } /* @@ -3601,13 +3602,14 @@ NSNamespaceRelease(Tcl_Namespace *nsPtr) { assert(nsPtr); + MEM_COUNT_FREE("NSNamespace", nsPtr); Tcl_Namespace_refCount(nsPtr)--; if (Tcl_Namespace_refCount(nsPtr) == 0 && (Tcl_Namespace_flags(nsPtr) & NS_DEAD)) { /* * The namespace refCount has reached 0, we have to free * it. unfortunately, NamespaceFree() is not exported */ - /* fprintf(stderr, "HAVE TO FREE %p\n", nsPtr); */ + fprintf(stderr, "HAVE TO FREE %p\n", nsPtr); /*NamespaceFree(nsPtr);*/ ckfree(nsPtr->fullName); ckfree(nsPtr->name); @@ -11999,15 +12001,17 @@ methodNameLength = 1 + cscPtr->objc - oc; nobjc = objc + methodNameLength; nobjv = (Tcl_Obj **)ckalloc(sizeof(Tcl_Obj *) * nobjc); + MEM_COUNT_ALLOC("nextArgumentVector", nobjv); /* - * copy the ensemble name + * copy the ensemble path name */ memcpy((char *)nobjv, cscPtr->objv, sizeof(Tcl_Obj *) * methodNameLength); } else { methodNameLength = 1; nobjc = objc + methodNameLength; nobjv = (Tcl_Obj **)ckalloc(sizeof(Tcl_Obj *) * nobjc); + MEM_COUNT_ALLOC("nextArgumentVector", nobjv); /* * copy the method name */ @@ -12084,6 +12088,7 @@ if (nobjv) { DECR_REF_COUNT(nobjv[0]); + MEM_COUNT_FREE("nextArgumentVector", nobjv); ckfree((char *)nobjv); }