mirror of
https://github.com/gnustep/libs-base.git
synced 2025-05-31 16:50:58 +00:00
Revert an nsthread change and try to avoid memory leaks when autorelease
pools are created during the thread exit process. git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@20287 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
e7fd84dbae
commit
d2161f1c01
3 changed files with 11 additions and 4 deletions
|
@ -1,3 +1,10 @@
|
||||||
|
2004-11-03 Richard Frith-Macdonald <rfm@gnu.org>
|
||||||
|
|
||||||
|
* 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 <rfm@gnu.org>
|
2004-11-01 Richard Frith-Macdonald <rfm@gnu.org>
|
||||||
|
|
||||||
* Source/GSFormat.h: Moved around includes somewhat so that the
|
* Source/GSFormat.h: Moved around includes somewhat so that the
|
||||||
|
|
|
@ -77,6 +77,7 @@ free_pool_cache (struct autorelease_thread_vars *tv)
|
||||||
{
|
{
|
||||||
NSZoneFree(NSDefaultMallocZone(), tv->pool_cache);
|
NSZoneFree(NSDefaultMallocZone(), tv->pool_cache);
|
||||||
tv->pool_cache = 0;
|
tv->pool_cache = 0;
|
||||||
|
tv->pool_cache_size = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -264,7 +264,7 @@ GSCurrentThread(void)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Fast access function for thread dictionary of current thread.<br />
|
* Fast access function for thread dictionary of current thread.<br />
|
||||||
* If there is no dictionary, and the thread is active, creates the dictionary.
|
* If there is no dictionary, creates the dictionary.
|
||||||
*/
|
*/
|
||||||
NSMutableDictionary*
|
NSMutableDictionary*
|
||||||
GSDictionaryForThread(NSThread *t)
|
GSDictionaryForThread(NSThread *t)
|
||||||
|
@ -281,7 +281,7 @@ GSDictionaryForThread(NSThread *t)
|
||||||
{
|
{
|
||||||
NSMutableDictionary *dict = t->_thread_dictionary;
|
NSMutableDictionary *dict = t->_thread_dictionary;
|
||||||
|
|
||||||
if (dict == nil && ((NSThread_ivars *)t)->_active == YES)
|
if (dict == nil)
|
||||||
{
|
{
|
||||||
dict = [t threadDictionary];
|
dict = [t threadDictionary];
|
||||||
}
|
}
|
||||||
|
@ -514,6 +514,7 @@ gnustep_base_thread_callback(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Terminating a thread
|
* Terminating a thread
|
||||||
* What happens if the thread doesn't call +exit - it doesn't terminate!
|
* 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.
|
* Try again to get rid of thread dictionary.
|
||||||
*/
|
*/
|
||||||
init_autorelease_thread_vars(&_autorelease_vars);
|
|
||||||
DESTROY(_thread_dictionary);
|
DESTROY(_thread_dictionary);
|
||||||
[NSAutoreleasePool _endThread: self];
|
[NSAutoreleasePool _endThread: self];
|
||||||
if (_thread_dictionary != nil)
|
if (_thread_dictionary != nil)
|
||||||
{
|
{
|
||||||
init_autorelease_thread_vars(&_autorelease_vars);
|
|
||||||
NSLog(@"Oops - leak - thread dictionary is %@", _thread_dictionary);
|
NSLog(@"Oops - leak - thread dictionary is %@", _thread_dictionary);
|
||||||
[NSAutoreleasePool _endThread: self];
|
[NSAutoreleasePool _endThread: self];
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue