diff --git a/ChangeLog b/ChangeLog index de2df486a..279c9f608 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2004-11-03 Richard Frith-Macdonald + + * Source/NSThread.m: Revert change from september to fix memory + leak ... Enrico says it broke some of his GSWorkspace code. + Will have to find a better fix ... ensure we don't leak autorelease + pools by repeatedly initalising thread autorelease variables. + 2004-11-01 Richard Frith-Macdonald * Source/GSFormat.h: Moved around includes somewhat so that the diff --git a/Source/NSAutoreleasePool.m b/Source/NSAutoreleasePool.m index 13f2c1af6..68ee4cb67 100644 --- a/Source/NSAutoreleasePool.m +++ b/Source/NSAutoreleasePool.m @@ -77,6 +77,7 @@ free_pool_cache (struct autorelease_thread_vars *tv) { NSZoneFree(NSDefaultMallocZone(), tv->pool_cache); tv->pool_cache = 0; + tv->pool_cache_size = 0; } } diff --git a/Source/NSThread.m b/Source/NSThread.m index fb96859bd..14f3abfbc 100644 --- a/Source/NSThread.m +++ b/Source/NSThread.m @@ -264,7 +264,7 @@ GSCurrentThread(void) /** * Fast access function for thread dictionary of current thread.
- * If there is no dictionary, and the thread is active, creates the dictionary. + * If there is no dictionary, creates the dictionary. */ NSMutableDictionary* GSDictionaryForThread(NSThread *t) @@ -281,7 +281,7 @@ GSDictionaryForThread(NSThread *t) { NSMutableDictionary *dict = t->_thread_dictionary; - if (dict == nil && ((NSThread_ivars *)t)->_active == YES) + if (dict == nil) { dict = [t threadDictionary]; } @@ -514,6 +514,7 @@ gnustep_base_thread_callback(void) } } + /** * Terminating a thread * What happens if the thread doesn't call +exit - it doesn't terminate! @@ -666,12 +667,10 @@ gnustep_base_thread_callback(void) /* * Try again to get rid of thread dictionary. */ - init_autorelease_thread_vars(&_autorelease_vars); DESTROY(_thread_dictionary); [NSAutoreleasePool _endThread: self]; if (_thread_dictionary != nil) { - init_autorelease_thread_vars(&_autorelease_vars); NSLog(@"Oops - leak - thread dictionary is %@", _thread_dictionary); [NSAutoreleasePool _endThread: self]; }