Hi All, I recently upgraded to gnustep-base-1.24.9. As part of the upgrade, I ran a test that repeatedly adds 3,000 operations to an NSOperationQueue. The operations do not do anything- they are just a subclass of NSOperation with an empty main method:
@implementation TheOperation
- (void)main
{
}
@end
The test is simply:
NSLog(@"Frobnicating, pass %u...", _pass);
for (i = 0; i < _numOperations; i++) {
TheOperation *op = [TheOperation new];
[q addOperation:op];
[op release];
}
[q waitUntilAllOperationsAreFinished];
NSLog(@"Frobnication took %.3f sec", -[start timeIntervalSinceNow]);
My program (attached for reference) runs this repeatedly until it's killed with
a signal. Normally, I can run it at least 10,000 times without a problem, but
since upgrading to 1.24.9, I'm finding that this code crashes after 2,796 runs,
with the following error from NSObject.m, at line 536:
NSIncrementExtraRefCount() asked to increment too far
I set a breakpoint on that error message, and got a stack trace (copied below)
which suggests that NSMutableDictionary's setObject:forKey: is being called too
many times with the same object from NSKeyValueObserving's notifyForKey:
(NSString *)aKey ofInstance: (id)instance prior: (BOOL)f method. However, I
compared the code for that method in 1.24.9 with the code in an older
gnustep-base, and I don't see any changes.
Does anyone know of a recent change that might have broken a behavior here?
Thanks,
David
Stack trace from when the breakpoint on NSObject.m error at line 536:
#0 NSIncrementExtraRefCount (anObject=0x6a24b0) at NSObject.m:536
#1 -[NSObject retain] (self=0x6a24b0, _cmd=0x7ffff7ce5710
<_OBJC_SELECTOR_TABLE+80>) at NSObject.m:1924
#2 0x00007ffff77afdb1 in -[GSMutableDictionary setObject:forKey:]
(self=0x2511d8fd0, _cmd=<optimized out>, anObject=0x6a24b0, aKey=0x7ffff7d47dc0
<_OBJC_INSTANCE_2>)
at GSDictionary.m:452
#3 0x00007ffff78a3a13 in -[GSKVOPathInfo notifyForKey:ofInstance:prior:]
(self=0x2511e3780, _cmd=<optimized out>, aKey=0x7ffff7d5d100
<_OBJC_INSTANCE_3>,
instance=0x25131a6d0, f=<optimized out>) at NSKeyValueObserving.m:1064
#4 0x00007ffff78a44c5 in -[NSObject(NSKeyValueObserverNotification)
didChangeValueForKey:] (self=0x25131a6d0, _cmd=<optimized out>,
aKey=0x7ffff7d5d100 <_OBJC_INSTANCE_3>) at NSKeyValueObserving.m:1754
#5 0x00007ffff78c6274 in -[NSOperation(Private) _finish] (self=0x25131a6d0,
_cmd=<optimized out>) at NSOperation.m:528
#6 0x00007ffff78c89b3 in -[NSOperationQueue(Private) _thread]
(self=0x250f39a80, _cmd=<optimized out>) at NSOperation.m:981
#7 0x00007ffff7930dd1 in nsthreadLauncher (thread=0x2512b2f30) at
NSThread.m:1208
#8 0x00007ffff6a4e192 in start_thread (arg=0x7fff547e0700) at
pthread_create.c:312
#9 0x00007ffff716a4ed in clone () at
../sysdeps/unix/sysv/linux/x86_64/clone.S:111
OpQueueTest.m
Description: OpQueueTest.m
_______________________________________________ Discuss-gnustep mailing list [email protected] https://lists.gnu.org/mailman/listinfo/discuss-gnustep
