Classes (and class-scope objects) are not collected until the class
loader that loaded the class is collected.  If you want this class to
be collected you need to load it with its own class loader.  However,
be aware that class collection may not be fully implemented on
Android.

On Feb 9, 4:55 am, Kacee <komal...@gmail.com> wrote:
> Hi all,
>
> I have a static instance singleton class object. I want that object to
> be garbage collected/null as soon as I close my application using back
> button.
>
> Whats happening is - My Object is alive, between two launch of
> application and hence retains the state. However,I am taking care of
> all instance variables by resetting them after their use by my own
> "class.reset()" method.
>
> What I want is to make my Class object eligible for gc as soon as I
> have come out of my applciation using "back" button. I dont want my
> object to stay on heap between two launches. As there may be a gap of
> few hrs / days between two launches of app on actual device. So dont
> want the object to be alive unnecessarily.
>
> I know, android will take care of gc when it will call ondestroy() at
> its own, but I think one should not rely on ondestroy().
>
> Can anyone please suggest any way to destroy objects right after
> application is stopped ? (although process is still visible in ddms)
>
> Thansk in advance.

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

Reply via email to