bug-gnustep
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[ 100838 ] Using NSURL as a key leaks memory


From: nobody
Subject: [ 100838 ] Using NSURL as a key leaks memory
Date: Wed, 01 May 2002 15:08:16 -0400

Support Request #100838, was updated on 2002-May-01 15:08
You can respond by visiting: 
http://savannah.gnu.org/support/?func=detailsupport&support_id=100838&group_id=99

Category: Foundation
Status: Open
Priority: 5
Summary: Using NSURL as a key leaks memory

By: lcampbel
Date: 2002-May-01 15:08

Message:
Logged In: NO 
Browser: Mozilla/4.5 (compatible; OmniWeb/4.1-v391; Mac_PowerPC)

The obvious way to implement an NSURLHandle cache is to use the NSURL as a key 
to an NSDictionary. However, this leaks gobs of memory because NSURL doesn't 
implement hash and isEqual:.

To fix, add these two methods to the NSURL implementation:

- (BOOL) isEqual: (NSURL *)other
{
    return [[self absoluteString] isEqualToString:[other absoluteString]];
}

- (unsigned) hash
{
    return [[self absoluteString] hash];
}



----------------------------------------------------------------------
You can respond by visiting: 
http://savannah.gnu.org/support/?func=detailsupport&support_id=100838&group_id=99



reply via email to

[Prev in Thread] Current Thread [Next in Thread]