bug-gnustep
[Top][All Lists]
Advanced

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

[ 100219 ] NSScanner memory leak


From: nobody
Subject: [ 100219 ] NSScanner memory leak
Date: Thu, 29 Nov 2001 18:22:06 -0500

Support Request #100219, was updated on 2001-Nov-29 23:22
You can respond by visiting: 
http://savannah.gnu.org/support/?func=detailsupport&support_id=100219&group_id=99

Category: Foundation
Status: Open
Priority: 5
Summary: NSScanner memory leak

By: jpyoung
Date: 2001-Nov-29 23:22

Message:
Logged In: YES 
user_id=3589
Browser: Mozilla/4.0 (compatible; MSIE 5.5; Windows NT 5.0)

NSScanner has a memory leak that manifests when it is
initialized with a Mutable String. The memory leak is
not present when it is initialized with a non-mutable
string. Sample program for demonstrating the leak 
follows:

#import <Foundation/Foundation.h>

int main(int argc, char *argv[]) {
    NSAutoreleasePool *pool = [[NSAutoreleasePool 
alloc] init];
    NSMutableString *aString = [NSMutableString 
stringWithFormat:@"aString"];

    for (;;) {
        NSAutoreleasePool *pool2 = [[NSAutoreleasePool 
alloc] init];
        NSScanner *aScanner = [NSScanner 
scannerWithString: aString];
        [pool2 release];
    }

    [pool release]; 
    exit(0);
}

Compile this and run it and you will see the memory 
usage of the program go up quickly. Simply changing 
the NSMutableString to an NSString will eliminate the 
leak.


I apologize if this has already been reported/fixed. I 
am new to the list.

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



reply via email to

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