0

My app is crash with the message : "Message from debugger: Terminated due to memory issue", when my tableview is reload with row counts are increased.

I have fetch the data on row from document directory path, and show the image of path on imageview of particular cell index, when the row count is reached at 10, it terminate with above mentioned message.

My code of cellForRowAt IndexPath is given below:

func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {

 let cell : signatureCell = tableView.dequeueReusableCell(withIdentifier: "signatureCell") as! signatureCell
  cell.selectionStyle = .none
    do
    {
        let imageURL = SignImagesURL[indexPath.row]
        let image = UIImage(contentsOfFile: imageURL.path)
        cell.imgSignature.image = image
    }
    catch {
    }
    return cell    
}  

Please give me the solutions to avoid it.

PPL
  • 6,357
  • 1
  • 11
  • 30
Appdev02
  • 11
  • 1
  • 1

2 Answers2

0

Probably there may be memory leaks or may be the memory is getting overload (like view controller is remain in memory even after pop/dismiss due to strong reference to it.)

To fix issue:

  • You need to build app with profile (cmd + i) and select Allocation from the options and then test you app.

  • You will see the all the view controllers that is being allocates and deallocates during testing.

  • Just identify the view controllers that are taking too much memory and try to optimise its memory.

  • Also you can identify the view controller that remains in memory (not deallocates) even after pop/dismiss.

Mahendra
  • 8,448
  • 3
  • 33
  • 56
0

To check the details of the Error Description, You can do the Following.

Goto Product -->Scheme -->Edit Scheme there you can enable the Checkbox of Zombie Object.

They you can able to see in console about which ViewController is deallocated.enter image description here