3

I made a mistake when using Leaks instrument that I thought total living objects is byte of memory, so I updated my post!

[Updated]

Hello All,

I am facing with a problem that:

My application present realtime data by using UITableView which may contains maximum 34 customized cells, so when receiving update data, I have to do reloadData for that UITableView, It usually be reloaded 2-3 times/second to update 2-5 cells (and addition that when a cell is updated, I use UiView animation to blinking the related text label).

When starting application, everything is ok, it run smoothly, but keep it running in about 20-30 minutes, it become slow down and sometime hang in a second. I did use Leaks instrument to test my application and see that after started it use about 17Mb of memory, but after 20-30 minutes, it use 25k-28k living object (1.7Mb of memory), When I tried to navigate over all screens, it use up to 80K living objects (6.5Mb of memory) :(

I guess that the UITableView is reloaded many times cause my application use more and more memory time after time and make it run slowly.

So anybody know how to resolve this problem, please help me, thanks you a lot!

3
  • So, did "Leaks" tell you what objects were being leaked? Oct 27, 2010 at 2:48
  • Show us some code. Do you use dequeueResusableCellWithIdentifier:?
    – tia
    Oct 27, 2010 at 3:20
  • @David: the Leaks instrument cannot tell me exactly what object is leaks, it just tell object type and in which class :( @tia: Yes already, I alway dequeue cell with cellIndentifier
    – Son Nguyen
    Oct 27, 2010 at 3:37

2 Answers 2

4

Could you use reloadRowsAtIndexPaths:withRowAnimation: instead?

3
  • Dear Marcelo, I will try this, but what will happen if the row which need to be updated is not visible on screen?
    – Son Nguyen
    Oct 27, 2010 at 3:39
  • Then UITableView won't do anything. It only needs to create cell views for visible rows. Oct 27, 2010 at 5:49
  • Thanks Marcelo, it's working well, just have to spent some more codes to check which row should be reload :)
    – Son Nguyen
    Oct 28, 2010 at 10:32
2

Correct memory leak instead of workaround...

At each data reception you should not release all data that increase your memory size.

4
  • Dear Benoit, I did a mistake when thought that total living objects is memory ;(, I updated my post
    – Son Nguyen
    Oct 27, 2010 at 6:24
  • I will inspect my code again, hope that find out the root cause :(
    – Son Nguyen
    Oct 27, 2010 at 6:27
  • Thanks Benoit, I did re-facter my code to reduce increase memory, it is better now
    – Son Nguyen
    Oct 28, 2010 at 10:34
  • @Son Nguyen Hi, Nguyen. how do you re-facter your cede?
    – aircraft
    Nov 28, 2016 at 11:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.