Note that there are some explanatory texts on larger screens.

plurals
  1. POMemory allocated when accessing CoreData to-many relationship not released?
    primarykey
    data
    text
    <p>I'm building a news app where you have a series of images representing the actual articles. When you tap one of them, it opens up the main article page, which has a scroll view on the bottom containing related articles.</p> <p>I found a strange (possibly CoreData related) problem regarding said bottom scroller. When I open the article page, I fetch the related articles, allocate a series of <code>articleViewControllers</code> and add their views to the scroll view. When I switch from the article page, I remove all the views from the scroller and release the <code>articleViewControllers</code>. Upon using Instruments and a couple of heapshots (one before tapping an article and another when switching back to the main page), I found that a substantial amount of memory remains allocated (see images)</p> <p><img src="https://i.stack.imgur.com/Svq6E.png" alt="enter image description here"></p> <p><img src="https://i.stack.imgur.com/KYtqh.png" alt="enter image description here"></p> <p>When viewing the non-object tab, I discover that most of the allocations happen at the following line of code, in the <code>viewDidLoad</code> method of the above mentioned <code>articleViewController</code>:</p> <pre><code> NSSet *tempSet = [[NSSet alloc] initWithSet:tempArticle.thumb]; //tempArticle.thumb is the actual problem here [tempSet release] </code></pre> <p><code>tempArticle</code> is an instance of the <code>Article</code> class, a subclass of NSManagedObject. If I comment out these two lines of code, everything works fine, so I'm guessing it's a consequence of faulty CoreData usage. </p> <p>Any help is appreciated. Thanks!</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    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. 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