views:

50

answers:

2

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  A: 

Could you use reloadRowsAtIndexPaths:withRowAnimation: instead?

Marcelo Cantos
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
Then UITableView won't do anything. It only needs to create cell views for visible rows.
Marcelo Cantos
Thanks Marcelo, it's working well, just have to spent some more codes to check which row should be reload :)
Son Nguyen
+1  A: 

Correct memory leak instead of workaround...

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

Benoît
Dear Benoit, I did a mistake when thought that total living objects is memory ;(, I updated my post
Son Nguyen
I will inspect my code again, hope that find out the root cause :(
Son Nguyen
Thanks Benoit, I did re-facter my code to reduce increase memory, it is better now
Son Nguyen