[cfe-dev] Weird Clang/LLVM behavior
Jordan Rose
jordan_rose at apple.com
Mon Mar 24 09:14:43 PDT 2014
[BCC cfe-dev]
This isn't really a Clang question; it's more about the Objective-C runtime. So the right place would be Apple's Developer Forums or bugreport.apple.com.
But my guess is that the NSInvocations are autoreleased, and (from the Concurrency Programming Guide), "Although GCD dispatch queues have their own autorelease pools, they make no guarantees as to when those pools are drained.".
Jordan
On Mar 24, 2014, at 2:58 , Mohit Sharma <mohit at mohitsharma0690.com> wrote:
> Hey guys,
>
> I'm looking at a weird thing going in my project. Wanted to know if you guys know about this or if it's a bug. I've some code like this
>
> dispatch_async(dispatch_get_global_queue(Default, 0), ^{
> for (int i = 0; i < 100000; i++) { // a big loop
> [a.b doSomethingWithI:i];
> }
> });
>
> The object "a" uses "forwardInvocation:" to get the property "b" and returns it. Now when I run this I see a huge number of NSInvocation objects being created for the forwardInvocation: never freeing the memory they used although the block is done executing.
>
> Also this only happens when I run it in Debug build. Moreover this never happens on the main queue. Seems like a bug to me but I might be wrong. Any ideas on what's going on?
>
>
> Thanks
> Mohit
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
More information about the cfe-dev
mailing list