29Jan/110

Two Tricks: Android Memory Leaks and Red Hat RPM Circular Dependencies

I learned two nifty tricks this week that are totally unrelated to each other.

One: if you get into a circular dependency when installing Red Hat RPMs, you can list them all in the install command at once. I think I knew this in the past, but it's been a long time since I had that problem, so I'd forgotten it.

rpm -ivh package1.rpm package2.rpm

Thanks to GeekGoesMeow for that. I was installing the gd-devel RPM, the exact situation as mentioned in one of the comments. It was maddening!

Two: quickly find one type of memory leak in your Android app by rotating your phone from vertical to horizontal orientation repeatedly. If you're storing Context, or anything derived from Context like an Activity, you will quickly encounter a Java OutOfMemoryError because on each context switch the previous context is not being properly garbage collected. Calling System.gc() won't help. Pass your Contexts and Activities from method to method, don't store them. This tip is thanks to Yusuf Saib speaking at a Silicon Valley Android Developers Meetup.

Filed under: Geekery Leave a comment
Comments (0) Trackbacks (0)

No comments yet.


Leave a comment


No trackbacks yet.