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 <danhi...@ieee.org> 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 <treking...@gmail.com> wrote:
>
>
>
> > On Tue, Aug 10, 2010 at 3:22 PM, Kumar Bibek <coomar....@gmail.com> 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 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