Added: 9 months ago
From: 24zTube
Views: 3,195
Sort by time | Sort by thread (beta)

Link to this comment:

Share to:

All Comments (3)

Sign In or Sign Up now to post a comment!
  • ...To prevent the leak you could implement a method that is called before you nil your array that loops through eacht object in the array and releases it (thus decreasing retain count to 1). Then when you nil your array the retain count is decreased again (becoming 0 and deallocing the object).

    So, instruments wouldn't know if youre going to release the objects before niling its references and cant display the "leak" before that is done. Because only after that, the leak occurs.

  • Sorry, I know this posting is older but I just found it and wanted to comment on it:

    As I understand a leaking object occurs when an object that is retained in memory loses all its references. So until you nil your array, the references arent lost and no leaking occurs. Also, in your for-loop I think you mention the retain count being 1. I think the retain count is 2 (alloc adds +1 and addObject to your array adds +1).

  • Awesome!

    Now I finally understand why leaking 'doesn't work' :)

    Great tuto!

Loading...
Alert icon
0 / 00Unsaved Playlist Return to active list
    1. Your queue is empty. Add videos to your queue using this button:
      or sign in to load a different list.
    Loading...Loading...Saving...
    • Clear all videos from this list
    • Learn more