On Mon, Oct 18, 2010 at 5:40 PM, John Gaby <[email protected]> wrote:
> Thanks for the input.  I am a little confused about your comment:
>
> 'The fact that you did not see the log from finalize() does not mean
> it did not happen.'

It is possible that the finalize() has been called at much later point.
I should have probably said that lack of finalize() does not mean that
the memory has not been regained.

As Dan points out, finalizers don't necessary run.

If Android decided to kill the process running finished application,
then it would simply do it on a system level, without trying to clean
the heap within that VM first.

If you want to see finalizers at work, allocate many objects that you
don't hold on to:

        for(int i=0; i<10000; i++ ) {
            MyClass x = new MyClass();
        }

...and then call the following:

        System.runFinalization();
        System.gc();

You should see your log statements.

-- 
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