views:

199

answers:

2

Hi,

I am New to this Android platfrom. In one application, there is a memory leak. But i couldn't able to find in which actiity or class the memory leak is happening.

I am using MAT to get the infirmation that the memory leak is there or not. But not able to find which activity is leaking.

Please tell me how to find the which activity is leaking.

Thanks.

A: 

As Android Programming model is been developed on virtual machine, developer need not worry about memory management.

Though programmer need to follow some guideline, Rule of thumb is - one need to initialize the object WHEN EVER ITS NEEDED. and with the proper scope.

If you think that app is consuming more memory you can do following two things, 1. Explicitly initialize null value to any object when app doesn't need any object. 2. User force GC button in DDMS (in your developer environment) and observe the unused objects and free them if not needed.

It is advisable to refer this http://developer.android.com/guide/practices/design/performance.html while working in performance intensive applications.

Rajnikant
A: 

I can't comment on the previous post, but it's important to realise that you absolutely should worry about memory management, especially on the resource-confined environment that is the Android mobile platform. For more on that, check here:

http://android-developers.blogspot.com/2009/01/avoiding-memory-leaks.html

jelford