From d4474d5baddde165c995c7716e6e0604788366a8 Mon Sep 17 00:00:00 2001 From: Miguel Sofer Date: Sat, 24 Aug 2002 01:29:46 +0000 Subject: 2002-08-23 Miguel Sofer * generic/tclObj.c (USE_THREAD_ALLOC): fixed leak [Bug 597936]. Thanks to Zoran Vasiljevic. --- ChangeLog | 5 +++++ generic/tclObj.c | 12 ++++++++---- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index b0d7879..15b2f95 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,10 @@ 2002-08-23 Miguel Sofer + * generic/tclObj.c (USE_THREAD_ALLOC): fixed leak [Bug 597936]. + Thanks to Zoran Vasiljevic. + +2002-08-23 Miguel Sofer + * generic/tclThreadAlloc.c (USE_THREAD_ALLOC): moving objects between caches as a block, instead of one-by-one. diff --git a/generic/tclObj.c b/generic/tclObj.c index 2eb61fd..2e4dc5e 100644 --- a/generic/tclObj.c +++ b/generic/tclObj.c @@ -11,7 +11,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclObj.c,v 1.39 2002/08/14 17:31:43 msofer Exp $ + * RCS: @(#) $Id: tclObj.c,v 1.40 2002/08/24 01:29:46 msofer Exp $ */ #include "tclInt.h" @@ -684,18 +684,22 @@ TclFreeObj(objPtr) * Tcl_Obj structs we maintain. */ - Tcl_MutexLock(&tclObjMutex); #if defined(TCL_MEM_DEBUG) || defined(PURIFY) + Tcl_MutexLock(&tclObjMutex); ckfree((char *) objPtr); -#else + Tcl_MutexUnlock(&tclObjMutex); +#elif defined(TCL_THREADS) && defined(USE_THREAD_ALLOC) + TclThreadFreeObj(objPtr); +#else + Tcl_MutexLock(&tclObjMutex); objPtr->internalRep.otherValuePtr = (VOID *) tclFreeObjList; tclFreeObjList = objPtr; + Tcl_MutexUnlock(&tclObjMutex); #endif /* TCL_MEM_DEBUG */ #ifdef TCL_COMPILE_STATS tclObjsFreed++; #endif /* TCL_COMPILE_STATS */ - Tcl_MutexUnlock(&tclObjMutex); } /* -- cgit v0.12