Using Xcode 5.0.2 on OS 10.8.5, I have an Objective-C++ ARC Foundation project that uses std::vector (actually a 2-D matrix). This matrix is generated in pieces, using separate NSOperations which report back, at the end of main(), as follows:
NSValue *value = [NSValue
valueWithPointer:[mcmc
getOutput]];
NSDictionary *data = "" style="color: #703daa">NSDictionary
dictionaryWithObjectsAndKeys:value,
@"output", nil];
[nc
postNotificationName:@"doneSolve"
object:nil
userInfo:data];
On the (unique) receiving end, I have
@synchronized(self) {
NSValue *output = [[notif
userInfo] objectForKey:@"output"];
vector<
vector<double> > *outData = (vector<
vector<double> >*)[output
pointerValue];
Output.insert(Output.end(), outData->begin(),
outData->end());
}
The receiver's final, complete Output matrix is initially OK but successive calls to NSLog()
NSLog(@"Output size = %lu",
Output.size());
report monotonically decreasing sizes for the receiver's Output matrix which I suspect is some bug in ARC under these conditions.
If I change the C++ library from
LLVM C++ standard library
to
GNU C++ standard library
the problem goes away.
I could not tell, from my searches, whether this was supposed to be something that was fixed or not. I realize that the insert() call requires some deep copying but I would have assumed
that LLVM knew all about that.
I would welcome any help on this. Thanks.
|