Be morte parimonious with resources.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@26084 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
rfm 2008-02-18 07:23:47 +00:00
parent 32891a37f6
commit 4daa8d64f8
2 changed files with 11 additions and 6 deletions

View file

@ -3,6 +3,9 @@
* Source/NSDistributedNotificationCenter.m: Remove delay and change * Source/NSDistributedNotificationCenter.m: Remove delay and change
code to immediately release resources used while trying to conneect code to immediately release resources used while trying to conneect
to server. to server.
* Source/NSConnection.m: When creating a connection and getting its
proxy, release the connection immediately if the proxy is nil, so
that repeated calls don't use more resources.
2008-02-17 19:21-EST Gregory John Casamento <greg_casamento@yahoo.com> 2008-02-17 19:21-EST Gregory John Casamento <greg_casamento@yahoo.com>

View file

@ -586,16 +586,17 @@ static NSLock *cached_proxies_gate = nil;
+ (NSDistantObject*) rootProxyForConnectionWithRegisteredName: (NSString*)n + (NSDistantObject*) rootProxyForConnectionWithRegisteredName: (NSString*)n
host: (NSString*)h host: (NSString*)h
{ {
CREATE_AUTORELEASE_POOL(arp);
NSConnection *connection; NSConnection *connection;
NSDistantObject *proxy = nil; NSDistantObject *proxy = nil;
connection = [self connectionWithRegisteredName: n host: h]; connection = [self connectionWithRegisteredName: n host: h];
if (connection != nil) if (connection != nil)
{ {
proxy = [connection rootProxy]; proxy = RETAIN([connection rootProxy]);
} }
RELEASE(arp);
return proxy; return AUTORELEASE(proxy);
} }
/** /**
@ -611,6 +612,7 @@ static NSLock *cached_proxies_gate = nil;
+ (NSDistantObject*) rootProxyForConnectionWithRegisteredName: (NSString*)n + (NSDistantObject*) rootProxyForConnectionWithRegisteredName: (NSString*)n
host: (NSString*)h usingNameServer: (NSPortNameServer*)s host: (NSString*)h usingNameServer: (NSPortNameServer*)s
{ {
CREATE_AUTORELEASE_POOL(arp);
NSConnection *connection; NSConnection *connection;
NSDistantObject *proxy = nil; NSDistantObject *proxy = nil;
@ -619,10 +621,10 @@ static NSLock *cached_proxies_gate = nil;
usingNameServer: s]; usingNameServer: s];
if (connection != nil) if (connection != nil)
{ {
proxy = [connection rootProxy]; proxy = RETAIN([connection rootProxy]);
} }
RELEASE(arp);
return proxy; return AUTORELEASE(proxy);
} }
+ (void) _timeout: (NSTimer*)t + (void) _timeout: (NSTimer*)t