Index: generic/nsf.c =================================================================== diff -u -r6862550e98368bea100b062583dc09da6a5dbbb6 -r27f3f462b1eab6ac548a8cf189317feede27278b --- generic/nsf.c (.../nsf.c) (revision 6862550e98368bea100b062583dc09da6a5dbbb6) +++ generic/nsf.c (.../nsf.c) (revision 27f3f462b1eab6ac548a8cf189317feede27278b) @@ -6568,8 +6568,8 @@ nonnull_assert(nsPtr != NULL); #ifdef OBJDELETION_TRACE - fprintf(stderr, "NSDeleteChildren %p %s activationCount %d\n", - (void *)nsPtr, nsPtr->fullName, Tcl_Namespace_activationCount(nsPtr)); + fprintf(stderr, "NSDeleteChildren %p %s activationCount %ld\n", + (void *)nsPtr, nsPtr->fullName, (long)Tcl_Namespace_activationCount(nsPtr)); #endif /* @@ -15785,8 +15785,8 @@ assert(object->teardown != NULL); #if defined(METHOD_OBJECT_TRACE) - fprintf(stderr, "method %p/%d '%s' type %p <%s>\n", - (void*)methodObj, methodObj->refCount, methodName, (void*)methodObjTypePtr, + fprintf(stderr, "method %p/%ld '%s' type %p <%s>\n", + (void*)methodObj, (long)methodObj->refCount, methodName, (void*)methodObjTypePtr, (methodObjTypePtr != NULL) ? methodObjTypePtr->name : ""); #endif /*fprintf(stderr, "==== ObjectDispatch obj = %s objc = %d 0=%s methodName=%s method-obj-type %s cmd %p shift %d\n", @@ -16058,8 +16058,8 @@ unsigned int nsfInstanceMethodEpoch = rst->instanceMethodEpoch; #if defined(METHOD_OBJECT_TRACE) - fprintf(stderr, "... method %p/%d '%s' type %p %s type? %d context? %d nsfMethodEpoch %d => %d\n", - (void*)methodObj, methodObj->refCount, ObjStr(methodObj), + fprintf(stderr, "... method %p/%ld '%s' type %p %s type? %d context? %d nsfMethodEpoch %d => %d\n", + (void*)methodObj, (long)methodObj->refCount, ObjStr(methodObj), (void*)methodObjTypePtr, (methodObjTypePtr != NULL) ? methodObjTypePtr->name : "NONE", methodObjTypePtr == &NsfInstanceMethodObjType, methodObjTypePtr == &NsfInstanceMethodObjType ? mcPtr0->context == currentClass : 0, @@ -21813,8 +21813,8 @@ #ifdef OBJDELETION_TRACE {Command *cmdPtr = (Command*)object->id; - fprintf(stderr, " physical delete of %p id=%p (cmd->refCount %d) destroyCalled=%d '%s'\n", - (void *)object, (void *)object->id, cmdPtr->refCount, + fprintf(stderr, " physical delete of %p id=%p (cmd->refCount %ld) destroyCalled=%d '%s'\n", + (void *)object, (void *)object->id, (long)cmdPtr->refCount, (object->flags & NSF_DESTROY_CALLED), ObjectName(object)); } #endif @@ -35355,7 +35355,7 @@ nonnull_assert(interp != NULL); nonnull_assert(nsPtr != NULL); - /* fprintf(stderr, "DeleteProcsAndVars in %s\n", nsPtr->fullName); */ + /*fprintf(stderr, "==== DeleteProcsAndVars in %s\n", nsPtr->fullName);*/ varTablePtr = (Tcl_HashTable *)Tcl_Namespace_varTablePtr(nsPtr); cmdTablePtr = Tcl_Namespace_cmdTablePtr(nsPtr); @@ -35400,6 +35400,8 @@ Tcl_DeleteCommandFromToken(interp, cmd); } } + /*fprintf(stderr, "==== DeleteProcsAndVars in %s DONE\n", nsPtr->fullName);*/ + } #endif @@ -35667,7 +35669,7 @@ nonnull_assert(interp != NULL); nonnull_assert(instances != NULL); - /*fprintf(stderr, "FreeAllNsfObjectsAndClasses in %p\n", interp);*/ + /*fprintf(stderr, "=== FreeAllNsfObjectsAndClasses in %p\n", interp);*/ RUNTIME_STATE(interp)->exitHandlerDestroyRound = NSF_EXITHANDLER_ON_PHYSICAL_DESTROY; @@ -35897,6 +35899,8 @@ } } } + /*fprintf(stderr, "=== FreeAllNsfObjectsAndClasses in %p DONE\n", interp);*/ + } #endif /* DO_CLEANUP */ Index: generic/nsfDebug.c =================================================================== diff -u -r745c46b4619253f283fe4285d1f4a83375e3d9d7 -r27f3f462b1eab6ac548a8cf189317feede27278b --- generic/nsfDebug.c (.../nsfDebug.c) (revision 745c46b4619253f283fe4285d1f4a83375e3d9d7) +++ generic/nsfDebug.c (.../nsfDebug.c) (revision 27f3f462b1eab6ac548a8cf189317feede27278b) @@ -252,13 +252,17 @@ nonnull_assert(id != NULL); if (!*tableInitialized) { - fprintf(stderr, "+++ alloc %s %p\n", id, p); + fprintf(stderr, "+++ alloc %s %p (table not initialized)\n", id, p); return; } hPtr = Tcl_CreateHashEntry(tablePtr, id, &new); #ifdef NSF_MEM_TRACE - fprintf(stderr, "+++ alloc %s %p\n", id, p); + if (*id == 'I' && strncmp("INCR_REF_COUNT", id, 14) == 0) { + fprintf(stderr, "+++ alloc %s %p (%ld)\n", id, p, ((Tcl_Obj*)p)->refCount); + } else { + fprintf(stderr, "+++ alloc %s %p\n", id, p); + } #endif if (new != 0) { entry = (NsfMemCounter*)ckalloc(sizeof(NsfMemCounter)); @@ -305,7 +309,12 @@ return; } #ifdef NSF_MEM_TRACE - fprintf(stderr, "+++ free %s %p\n", id, p); + if (*id == 'I' && strncmp("INCR_REF_COUNT", id, 14) == 0) { + fprintf(stderr, "+++ free %s %p (%ld)\n", id, p, ((Tcl_Obj*)p)->refCount); + } else { + fprintf(stderr, "+++ free %s %p\n", id, p); + } + #endif hPtr = Tcl_FindHashEntry(tablePtr, id); Index: generic/nsfObj.c =================================================================== diff -u -r5ee4c3c7cdbf4620ffb4f9a7f69751f3c9647e2c -r27f3f462b1eab6ac548a8cf189317feede27278b --- generic/nsfObj.c (.../nsfObj.c) (revision 5ee4c3c7cdbf4620ffb4f9a7f69751f3c9647e2c) +++ generic/nsfObj.c (.../nsfObj.c) (revision 27f3f462b1eab6ac548a8cf189317feede27278b) @@ -106,6 +106,8 @@ FREE(NsfMethodContext, mcPtr); objPtr->internalRep.twoPtrValue.ptr1 = NULL; objPtr->typePtr = NULL; + } else { + fprintf(stderr, "NSF Warning: MethodFreeInternalRep of '%s' has no internal rep\n", Tcl_GetString(objPtr)); } } @@ -183,7 +185,7 @@ objPtr->internalRep.twoPtrValue.ptr2 = NULL; objPtr->typePtr = objectType; #if defined(METHOD_OBJECT_TRACE) - fprintf(stderr, "alloc %p methodContext %p methodEpoch %d type <%s> %s refCount %d\n", + fprintf(stderr, "methodObj alloc %p methodContext %p methodEpoch %d type <%s> %s refCount %d\n", (void *)objPtr, (void *)mcPtr, methodEpoch, objectType->name, ObjStr(objPtr), objPtr->refCount); #endif