On Tue, Jan 18, 2011 at 4:24 AM, Sapna Srivastav <[email protected]> wrote:
> I am developing an application that will run 24x7 in which I used an
> Alarm Manager for executing the application on every 1 minute by
> setRepeating() method having entry of android:process=":remote" in
> manifest.xml.

Please remove the android:process=":remote" attribute. Forcing a new
process, particularly every minute, is wasteful of CPU, RAM, and
battery.

Please allow the user to configure the frequency of your alarms and
set the default period to be much slower than once per minute. Users
may not appreciate your code running every minute.

> The application size on heap increases gradually, I
> called onDestroy(), finish() ,Runtime.getRuntime().gc and System.gc()
> methods for cleaning the heap but it doesn't work. The heap size, that
> I get from Debug.getHeapAllocatedSize(), is continuously increasing.
>
> How can I free the allocated memory when application is not running?

First, you need much better proof that you are leaking memory. Have
your alarm invoke a number of times (e.g., 50), then stop. At that
point, use DDMS to run a few garbage collection cycles, then dump an
HPROF file. Use Eclipse MAT to examine the HPROF file and see if any
of your objects are there, or if there are other positive signs of
your leak.

-- 
Mark Murphy (a Commons Guy)
http://commonsware.com | http://github.com/commonsguy
http://commonsware.com/blog | http://twitter.com/commonsguy

_The Busy Coder's Guide to *Advanced* Android Development_ Version 1.9
Available!

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to