[Solved] memory leak when calling an Api [closed]


You should refresh your memory (no pun intended) what a memory leak is. No, having thousands of entries in memory does not necessarily lead to memory leak (the main source of memory leaks in Swift are closures). It could, however, increase the memory pressure – which means your app could run out of free memory which could lead to unexpected behavior (iOS would notify your app in advance by calling didReceiveMemoryWarning() method of your view controllers).

As for UITableView, it only allocates memory for visible cells which is usually about 10 rows. While you scroll the table view, it would reuse those cells (it calls prepareForReuse() method on those cells) that disappear from the screen and repositions them so that they are displayed with new content.

solved memory leak when calling an Api [closed]