Wednesday, April 24, 2013

No memory leak, still app is out of memory?

In iPhone/iPad app I have came across many situations where there was absolutely no memory leak, but app was crashing after some time due to out of memory. The reason could be many. Your application may be huge and you are using many resources/data which you are not using but still not releasing them.

Most of the time this happens with images. Below line could be fetal.


UIImage *img = [UIImage imageNamed:@"someimage.png"];

The method imageNamed from UIImage caches image data so that it could load it faster next time. This is great for smaller images, but shouldn't be used for heavy images. Instead use imageWithContentsOfFile method.

What happens with imageNamed method is that, if your app loads n number of images then all those images will be cached and will never be released until the app is quit. You may not see any memory leak using static-analyzer or in instruments. If you see the allocation in instruments you may see steady increase in the allocated memory which is never used.

Saturday, October 15, 2011

Update to XCode 4.2 in Mac OSX Lion

Today i faced a strange problem while updating Xcode from 4.1 to 4.2 using mac app store in lion. Mac store was giving me a option to update Xcode to 4.2. So i pressed update button. It was written 1.6GB. But to my surprise it downloaded around 3.4 GB (i think it downloaded reference library). When download got finished i clicked on Xcode icon in launchpad to install. But after installing Xcode was still 4.1. Many might have faced this problem. Finally i was able to install Xcode. you can follow the steps given below. Correct me if iam wrong here or if it didn't work for you

  1. Un-Install XCode by command  sudo /Developer/Library/uninstall-devtools --mode=all
  2. Restart your Mac
  3. Delete the file XCode Install.app from your mac. It could be in your Applications directory or in Downloads or wherever it is. Delete from trash also. (Here Xcode Install.app is the previous installation file which you used to install XCode 4.1 in lion). This is very important step.
  4. Now go to mac store, search for XCode and install
I am yet to explore Xcode 4.2. Happy coding
Thank you

Saturday, October 8, 2011

Keep Passwords Safe

     Today we live in two worlds. One is real world and other is virtual (internet/cyber/computer) world. Even-though both worlds exists in different space, they are connected, and we can say they are interconnected.
    To make private belongings of a person safe in internet world PASSWORD is the key factor. For email, twitter, Facebook, bank account etc password is the protector. But most people do mistake here. Everyone has difficulty in remembering passwords. So they keep same password for all accounts. Another reason for keeping same password is, most sites use email-id as the login or username. So people think we have to give real password of their email id while creating the account. This we can see practically see in Facebook accounts. While creating Facebook account email-id is taken as login or user name, then it asks for password. People simply type same password of their email id here.

The thing i want to put forward is

  1. Don't use same password for all your accounts
  2. If email-id is asked as login name while creating a account, then don't use the same password of that email id for new account.
  3. Don't use option of remember password in web-browsers (Firefox, chrome)
  4. Use some uppercase letters and numbers in password to make it hard to guess
  5. If you are using public computer use Private browsing option in Firefox and new incognito window in chrome
Safe browsing

Monday, February 7, 2011

Pinch Zoom UITableView


We can give pinch zoom feature to UITableView using UIPinchGesture. Below is the subclass of UITableView which can be directly used to enable pinch zoom capability for your table view. Just you need to change the class of UITable in nib as shown below.

Just you need to add "PinchZoomTableView.h" and "PinchZoomTableView.m" to your project. Then change the class from UITableView to PinchZoomTableView in the nib file where UITable is used. You can download the sample project from https://github.com/sachithkadamba/PinchZoomUITableView.  Or You can copy paste PinchZoomTableView.h and PinchZoomTableView.m from below.


Please leave comments if this post helped you and also please share the code if you have fixed any bug or improved this code so that it helps others.

Monday, January 1, 2001

Privacy Policy

This blog does not share personal information with third parties nor do we store any information about your visit to this blog other than to analyze and optimize your content and reading experience through the use of cookies.

You can turn off the use of cookies at anytime by changing your specific browser settings.

We are not responsible for republished content from this blog on other blogs or websites without our permission.

This privacy policy is subject to change without notice. If you have any questions feel free to contact me directly here sachk1988@gmail.com