Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>EDIT:</p> <p>indeed, it seems there is some king of bug in iOS SDK 5.1 strdup (or related). See this thread from the <a href="https://devforums.apple.com/message/630695" rel="nofollow">developers forum</a>.</p> <p>it would be interesting if you can dig a bit into the Elements sample (which is the one that is said to reveal the bug) and see if you are using the same kind of functionality.</p> <p>Here is a stack trace at the moment of the leak:</p> <pre><code> 0 libsystem_c.dylib malloc 1 libsystem_c.dylib strdup 2 libnotify.dylib token_table_add 3 libnotify.dylib notify_register_mach_port 4 libnotify.dylib notify_register_dispatch 5 CoreFoundation _CFXNotificationRegisterObserver 6 CoreFoundation CFNotificationCenterAddObserver 7 UIKit -[UIScrollView(Static) _startTimer:] 8 UIKit -[UIScrollView _endPanWithEvent:] 9 UIKit -[UIScrollView handlePan:] 10 UIKit _UIGestureRecognizerSendActions 11 UIKit -[UIGestureRecognizer _updateGestureWithEvent:] 12 UIKit ___UIGestureRecognizerUpdate_block_invoke_0541 13 UIKit _UIGestureRecognizerApplyBlocksToArray 14 UIKit _UIGestureRecognizerUpdate 15 UIKit _UIGestureRecognizerUpdateGesturesFromSendEvent 16 UIKit -[UIWindow _sendGesturesForEvent:] 17 UIKit -[UIWindow sendEvent:] 18 UIKit -[UIApplication sendEvent:] 19 UIKit _UIApplicationHandleEvent 20 GraphicsServices PurpleEventCallback 21 CoreFoundation __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ 22 CoreFoundation __CFRunLoopDoSources0 23 CoreFoundation __CFRunLoopRun 24 CoreFoundation CFRunLoopRunSpecific 25 CoreFoundation CFRunLoopRunInMode 26 GraphicsServices GSEventRunModal 27 UIKit UIApplicationMain 28 TheElements 0x300a 29 TheElements 0x2fc3 </code></pre> <p>You can get your stack trace at the moment of the leak by choosing "Show Extended Detail" (or something similar) in the Instruments View menu.</p> <p>OLD ANSWER:</p> <p>I suspect it is not.</p> <p>In fact, what Instruments shows you as "responsible library" is the place where the actual <code>malloc</code> call was effectively executed.</p> <p>If you look at Instruments output, the culprit call is <code>strdup</code>: there cannot possibly be a leak in <code>strdup</code>.</p> <p>It is more likely that you asked the OS (directly or indirectly) to duplicate some string, but then managed incorrectly the resulting copy of the string.</p> <p>Analyze the Extended Detail View which Instruments offer you, which shows the call stack at the moment the <code>malloc</code> was called. This <em>may</em> help if there is a direct relationship between your code and the <code>malloc</code> call itself. But even if the detailed view does not show such relationship, keep looking for the cause of the leak in your code.</p> <p>More in general, try to understand which part of your app is running when the leak is found (take into account the fact that leaks analysed at discrete times, e.g., every 10 seconds, so when you see the red bar appear, that means that the leak was produced during the last 10 seconds), and review all memory operations you do in the relevant classes.</p> <p>In my experience, it is pretty normal (100% of cases) that Instruments shows some part of the SDK as "responsible" for a leak, but at a deeper analysis the wrong code is on my part.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload