As I mentioned earlier, many JVMs disable System.gc by default, since
the function is so often abused, and since doing unnecessary GCs is a
major performance drag.  When inserting GC calls in your code you
should be sensitive to this and use only the bare minimum necessary to
achieve "correct' (in the Android sense) operation.

On Aug 10, 5:16 pm, Streets Of Boston <[email protected]> wrote:
> I agree with you, but since the dalvik-vm does not 'see' the raw
> binary image data in Bitmaps, it may not kick of the garbage collector
> when process memory gets low. Calling System.gc() explicitly does work-
> around this problem and it seems to work, in my experience.
>
> On Aug 10, 4:43 pm, DanH <[email protected]> wrote:
>
> > I'll add that if you need to call System.gc to prevent an error then
> > there's a bug in the JVM.  (Not saying that there's no bug and hence
> > no need to call it, just saying that, per the Java spec, the system
> > should automatically do a GC before raising any "hard" out-of-heap
> > error.  The observations by the others above is presumably an
> > Androidism, not proper Java behavior.)
>
> > On Aug 10, 3:28 pm, TreKing <[email protected]> wrote:
>
> > > On Tue, Aug 10, 2010 at 3:22 PM, Kumar Bibek <[email protected]> wrote:
> > > > I think calling System.gc() doesn't immediately trigger the
> > > > garbage collection. So, relying on this all the time might not be a good
> > > > idea.
>
> > >http://download.oracle.com/javase/1.4.2/docs/api/java/lang/System.htm...()
>
> > > <http://download.oracle.com/javase/1.4.2/docs/api/java/lang/System.htm...()>
> > > "When control returns from the method call, the Java Virtual Machine has
> > > made a best effort to reclaim space from all discarded objects."
>
> > > ---------------------------------------------------------------------------­----------------------
> > > TreKing <http://sites.google.com/site/rezmobileapps/treking> - Chicago
> > > transit tracking app for Android-powered devices- Hide quoted text -
>
> > - Show quoted text -

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