App is not smooth on the device?
I have made an administration app which shows allot of data in tables,if i debug the app or just run the app on the simulator the app works very smoothly and does not lags at all, but when i run/debug/release the app on the iPad it self, its laggy, and responds after 1/2 seconds to a user interaction.., why is this? i have no memory leaks at all, im perfectly allocating and release objects that i use(atleast i think i am).
this is how i do it,
if([tablearrayTENNANTSID retainCount] != 1){tablearrayTENNANTSID = [[NSMutableArray alloc]init]; }
else {[tablearrayTENNANTSID removeAllObjects];}
so.. basically the tennantIDarray retainscount cant go higher then 1 because thats the only place where it gets allocated and when i want to put new data in the array i removeall objects in it and put the new objects in it which i receive from a JSON array's
Thanks alr开发者_运维技巧eady!
NEVER use the retainCount
as a reference! The retainCount
is only for intern purposes to manage the object. Make a comparison against nil. If at this point the retainCount
is 2, you leak memory...
Do it like this:
if(tablearrayTENNANTSID == nil){
tablearrayTENNANTSID = [[NSMutableArray alloc]init];
}
else {
[tablearrayTENNANTSID removeAllObjects];
}
and in dealloc
(assuming tablearrayTENNANTSID
is a iVar) relase it.
Sandro Meier
I have made an administration app which shows allot of data in tables,if i debug the app or just run the app on the simulator the app works very smoothly and does not lags at all, but when i run/debug/release the app on the iPad it self, its laggy, and responds after 1/2 seconds to a user interaction.., why is this?
the simulator does not simulate the hardware. the simulator simulates the operating system.
your app will execute several times faster in the simulator. one prominent difference is the processor speed and count of logical cores.
there are of course other hardware and software differences between the simulator and an actual device (e.g. the simulator does not simulate the relative cost of floating point instructions -- intel cpus are much faster relative to arm device cpus). you'll also have more memory on the simulator (typically). all these differences add up such that you experience much faster execution times on the simulator.
i have no memory leaks at all, im perfectly allocating and release objects that i use(atleast i think i am).
you can confirm this by running the app with instruments.
as for why your app is slow: you can profile (a release version of) your app on the device in order to determine where it's spending its time. if it comes down to cpu time and you are targeting the ipad, remember that you have 2 cores to utilize.
精彩评论