Index: generic/nsf.c =================================================================== diff -u -r563d2de98a63e09432eb9b0840434ea5e9b20052 -rb57f4b6701eadc6f177da91291638d26da3322ba --- generic/nsf.c (.../nsf.c) (revision 563d2de98a63e09432eb9b0840434ea5e9b20052) +++ generic/nsf.c (.../nsf.c) (revision b57f4b6701eadc6f177da91291638d26da3322ba) @@ -22553,7 +22553,7 @@ /* Tcl_GlobalEval(interp, "puts {checkmem to checkmemFile}; checkmem checkmemFile"); */ #endif - MEM_COUNT_RELEASE(interp); + MEM_COUNT_RELEASE(); ckfree((char *) RUNTIME_STATE(interp)); Tcl_Interp_flags(interp) = flags; @@ -22645,7 +22645,7 @@ * first call to the MEM_COUNT macros (including e.g. INCR_REF_COUNT), but * it requires that the runtimeState is already associated with the interp. */ - MEM_COUNT_INIT(interp); + MEM_COUNT_INIT(); /* * Init global variables for Tcl_Obj types Index: generic/nsfInt.h =================================================================== diff -u -rf177b4dbbb589f91704b1acb8dfbd91fc076335a -rb57f4b6701eadc6f177da91291638d26da3322ba --- generic/nsfInt.h (.../nsfInt.h) (revision f177b4dbbb589f91704b1acb8dfbd91fc076335a) +++ generic/nsfInt.h (.../nsfInt.h) (revision b57f4b6701eadc6f177da91291638d26da3322ba) @@ -92,15 +92,15 @@ int peak; int count; } NsfMemCounter; -# define MEM_COUNT_ALLOC(id,p) NsfMemCountAlloc(interp, id, p) -# define MEM_COUNT_FREE(id,p) NsfMemCountFree(interp, id, p) -# define MEM_COUNT_INIT(interp) NsfMemCountInit(interp) -# define MEM_COUNT_RELEASE(interp) NsfMemCountRelease(interp) +# define MEM_COUNT_ALLOC(id,p) NsfMemCountAlloc(id, p) +# define MEM_COUNT_FREE(id,p) NsfMemCountFree(id, p) +# define MEM_COUNT_INIT() NsfMemCountInit() +# define MEM_COUNT_RELEASE() NsfMemCountRelease() #else # define MEM_COUNT_ALLOC(id,p) # define MEM_COUNT_FREE(id,p) -# define MEM_COUNT_INIT(interp) -# define MEM_COUNT_RELEASE(interp) +# define MEM_COUNT_INIT() +# define MEM_COUNT_RELEASE() #endif # define STRING_NEW(target, p, l) target = ckalloc(l+1); strncpy(target, p, l); *((target)+l) = '\0'; \ @@ -791,9 +791,6 @@ NsfStringIncrStruct iss; /* used for new to create new symbols */ short guardCount; /* keep track of guard invocations */ ClientData clientData; -#if defined(NSF_MEM_COUNT) - Tcl_HashTable memCountTable; -#endif } NsfRuntimeState; #define NSF_EXITHANDLER_OFF 0 @@ -860,10 +857,10 @@ * MEM Counting */ #ifdef NSF_MEM_COUNT -void NsfMemCountAlloc(Tcl_Interp *interp, char *id, void *); -void NsfMemCountFree(Tcl_Interp *interp, char *id, void *); -void NsfMemCountInit(Tcl_Interp *interp); -void NsfMemCountRelease(Tcl_Interp *interp); +void NsfMemCountAlloc(char *id, void *); +void NsfMemCountFree(char *id, void *); +void NsfMemCountInit(); +void NsfMemCountRelease(); #endif /* NSF_MEM_COUNT */ /* Index: generic/nsfTrace.c =================================================================== diff -u -rcae9407ff24389d6f950a07279adb31750793e02 -rb57f4b6701eadc6f177da91291638d26da3322ba --- generic/nsfTrace.c (.../nsfTrace.c) (revision cae9407ff24389d6f950a07279adb31750793e02) +++ generic/nsfTrace.c (.../nsfTrace.c) (revision b57f4b6701eadc6f177da91291638d26da3322ba) @@ -119,7 +119,7 @@ *---------------------------------------------------------------------- */ static Tcl_HashTable * -NsfMemCountGetTable(Tcl_Interp *interp, int **initialized) { +NsfMemCountGetTable(int **initialized) { static Tcl_ThreadDataKey memCountTableKey; static Tcl_ThreadDataKey memCountFlagKey; Tcl_HashTable *tablePtr; @@ -148,18 +148,17 @@ *---------------------------------------------------------------------- */ void -NsfMemCountAlloc(Tcl_Interp *interp, char *id, void *p) { +NsfMemCountAlloc(char *id, void *p) { int new, *tableInitialized; NsfMemCounter *entry; - Tcl_HashTable *tablePtr = NsfMemCountGetTable(interp, &tableInitialized); + Tcl_HashTable *tablePtr = NsfMemCountGetTable(&tableInitialized); Tcl_HashEntry *hPtr; if (!*tableInitialized) { fprintf(stderr, "+++ alloc %s %p\n", id, p); return; } - assert(interp); hPtr = Tcl_CreateHashEntry(tablePtr, id, &new); #ifdef NSF_MEM_TRACE fprintf(stderr, "+++ alloc %s %p\n", id, p); @@ -197,10 +196,10 @@ */ void -NsfMemCountFree(Tcl_Interp *interp, char *id, void *p) { +NsfMemCountFree(char *id, void *p) { NsfMemCounter *entry; int *tableInitialized; - Tcl_HashTable *tablePtr = NsfMemCountGetTable(interp, &tableInitialized); + Tcl_HashTable *tablePtr = NsfMemCountGetTable(&tableInitialized); Tcl_HashEntry *hPtr; if (!*tableInitialized) { @@ -211,7 +210,6 @@ fprintf(stderr, "+++ free %s %p\n", id, p); #endif - assert(interp); hPtr = Tcl_FindHashEntry(tablePtr, id); if (!hPtr) { fprintf(stderr, "******** MEM COUNT ALERT: Trying to free %p <%s>, " @@ -238,9 +236,9 @@ *---------------------------------------------------------------------- */ void -NsfMemCountInit(Tcl_Interp *interp) { +NsfMemCountInit() { int *tableInitialized; - Tcl_HashTable *tablePtr = NsfMemCountGetTable(interp, &tableInitialized); + Tcl_HashTable *tablePtr = NsfMemCountGetTable(&tableInitialized); if (!*tableInitialized) { Tcl_InitHashTable(tablePtr, TCL_STRING_KEYS); @@ -270,19 +268,19 @@ *---------------------------------------------------------------------- */ void -NsfMemCountRelease(Tcl_Interp *interp) { +NsfMemCountRelease() { int *tableInitialized; - Tcl_HashTable *tablePtr = NsfMemCountGetTable(interp, &tableInitialized); + Tcl_HashTable *tablePtr = NsfMemCountGetTable(&tableInitialized); Tcl_HashSearch search; Tcl_HashEntry *hPtr; int count = 0; #ifdef NSF_MEM_TRACE - fprintf(stderr, "+++ release interp %p count %d\n", interp, *tableInitialized); + fprintf(stderr, "+++ release count %d\n", *tableInitialized); #endif if (!*tableInitialized) { - fprintf(stderr, "+++ release called on uninitialized/free hash table, interp %p\n", interp); + fprintf(stderr, "+++ release called on uninitialized/free hash table\n"); return; } Index: tests/protected.test =================================================================== diff -u -r563d2de98a63e09432eb9b0840434ea5e9b20052 -rb57f4b6701eadc6f177da91291638d26da3322ba --- tests/protected.test (.../protected.test) (revision 563d2de98a63e09432eb9b0840434ea5e9b20052) +++ tests/protected.test (.../protected.test) (revision b57f4b6701eadc6f177da91291638d26da3322ba) @@ -214,7 +214,8 @@ ? {c1 foo} "c1.baz" # - # define a mixin class which shadows "bar" and "baz" + # Define a mixin class which shadows "bar" and "baz". The behavior + # of the object-methods with its private methods is not affected. # nx::Class create M { :public method bar {} {return "M.bar [next]"}