Question

My iOS 7 app works fine at the beginning. Without user interaction, the processor load goes back to 0 percent.

Then, after some time of using it, the processor load increases suddenly to 100 % and stays there.

Instruments shows a threat called _pthread_tsd_cleanup (libsystem_pthread.dylib).

I tried to find more information on this but I still have no solution.

Call tree from Instruments:

Running Time    Self        Symbol Name
   653458.0ms   99.9%   0.0     _pthread_tsd_cleanup  0x6a712
   653458.0ms   99.9%   0.0      _pthread_wqthread
   653458.0ms   99.9%   0.0       _pthread_exit
   653458.0ms   99.9%   0.0        _pthread_tsd_cleanup
   653458.0ms   99.9%   0.0         FreeContextStack
   594802.0ms   91.0%   52562.0          PopContext
   366935.0ms   56.1%   25844.0           GetContextStack
   260166.0ms   39.8%   99324.0            GetContextStack
   160842.0ms   24.6%   160842.0                pthread_once
   41188.0ms    6.3%    41188.0            pthread_getspecific
   39737.0ms    6.0%    39737.0            pthread_once
   157048.0ms   24.0%   87958.0           PopContext
   69090.0ms   10.5%    69090.0            GetContextStack
   15386.0ms    2.3%    15386.0           DYLD-STUB$$pthread_once
   2871.0ms    0.4% 2871.0            DYLD-STUB$$pthread_getspecific
   58656.0ms    8.9%    24503.0          FreeContextStack
   34153.0ms    5.2%    34153.0           PopContext
   143.0ms    0.0%  0.0     Main Thread  0x6a6e9
   3.0ms    0.0%    0.0     _dispatch_worker_thread2  0x6ac4e
   2.0ms    0.0%    0.0     _dispatch_worker_thread2  0x6b020
   1.0ms    0.0%    0.0     _pthread_tsd_cleanup  0x6ae2a
   1.0ms    0.0%    0.0     _dispatch_worker_thread2  0x6b2b9
   1.0ms    0.0%    0.0     _dispatch_mgr_thread  0x6a710
   1.0ms    0.0%    0.0     start_wqthread  0x6af42
   1.0ms    0.0%    0.0     _dispatch_worker_thread2  0x6b195
   1.0ms    0.0%    0.0     _dispatch_worker_thread2  0x6b0c1
Was it helpful?

Solution 2

I found the answer myself by commenting out different parts of my code until I could pinpoint the part of my code that caused this behavior.

The problem was caused by the following code segment, which I used to change the color of icons..

UIGraphicsBeginImageContextWithOptions(image.size, NO, image.scale);
CGContextRef context = UIGraphicsGetCurrentContext();
[color setFill];
CGContextTranslateCTM(context, 0, image.size.height);
CGContextScaleCTM(context, 1.0, -1.0);
CGContextClipToMask(context, CGRectMake(0, 0, image.size.width, image.size.height), [image CGImage]);
CGContextFillRect(context, CGRectMake(0, 0, image.size.width, image.size.height));

OTHER TIPS

I had the same symptoms and it was because not all UIGraphicsBeginImageContextWithOptions(...) calls had corresponding calls to UIGraphicsEndImageContext().

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top