bug-gnustep
[Top][All Lists]
Advanced

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

[bug #59204] NSOperationQueue leak


From: Larry Campbell
Subject: [bug #59204] NSOperationQueue leak
Date: Tue, 29 Sep 2020 08:39:17 -0400 (EDT)
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_6) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.1.2 Safari/605.1.15

URL:
  <https://savannah.gnu.org/bugs/?59204>

                 Summary: NSOperationQueue leak
                 Project: GNUstep
            Submitted by: lcampbel
            Submitted on: Tue 29 Sep 2020 12:39:15 PM UTC
                Category: None
                Severity: 3 - Normal
              Item Group: None
                  Status: None
                 Privacy: Public
             Assigned to: None
             Open/Closed: Open
         Discussion Lock: Any

    _______________________________________________________

Details:

The following code demonstrates that NSOperationQueue leaks operations. It
should (and, on Mac OS X, does) print "t retain count is 1" at the end. On
gnustep, it prints "t retain count is 2".

#import <Foundation/Foundation.h>

@interface Test : NSObject
@end

@implementation Test

- (void)frob
{
    NSLog(@"frob");
}

- (void)test
{
    NSAutoreleasePool *pool = [NSAutoreleasePool new];
    NSOperationQueue *opq = [[NSOperationQueue new] autorelease];
    NSInvocationOperation *op = [[[NSInvocationOperation alloc]
initWithTarget:self selector:@selector(frob) object:nil] autorelease];
    [opq addOperation:op];
    [opq waitUntilAllOperationsAreFinished];
    [pool release];
}

@end

int main(int argc, char *argv[])
{
    NSAutoreleasePool *pool = [NSAutoreleasePool new];
    Test *t = [[Test new] autorelease];
    [t test];
    NSLog(@"t retain count is %lu", [t retainCount]);
    [pool release];
    return 0;
}





    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?59204>

_______________________________________________
  Message sent via Savannah
  https://savannah.gnu.org/




reply via email to

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