Posts Tagged 'Java'

Android: Finding Memory Leaks

Recently while I was working on the next version of Archer Master, I’ve had to roll up my sleeves and find a memory leak. By and large, a memory leak in one’s application is frequently a synonym for having painful time, no matter which language you’re coding in. I have experience in finding leaks in the non-managed languages such as C/C++ but this was my very first time with a managed language (Java). In my case, the leak was caused by a lost strong-reference to a LinearLayout used to hold advertising, so each time a level was played, the entire activity remained in memory and wasn’t collected. As a result, after playing several levels (the number depended upon the particular device), a OOM exception raised and the game crashed.

It’d have been virtually impossible to find the leak without a tool like MAT. Moreover, a good understanding of the different types of references (strong, weak, soft…) and the concept of Dominator Tree  also help.

When I’ve got a little more time I’ll write about the whole process I went thru (if anyone is really interested please let me know)… but meanwhile, this is an invaluable resource if you find yourself in a similar situation and don’t know how to start:

Good luck with your leaks! 😉

_______________________________________________________________

Developing Android Apps with Java Part 2

It’s been announced the second part of the course “Developing Android Apps with Java” by O’Reilly. It will start in May 18th and it’s going to consist of six sessions in which a Twitter client app for Android will be developed. Interested? You can register for free at the course home page.  No excuses to learn Android Programming 😉

I wrote a review of the first part of the course in this post.

_______________________________________________________________


Who’s in charge here?

Follow me on Quoders Blog…



Quoders Twitter

License