On Thu, Mar 14, 2013 at 12:28 PM, Piren <[email protected]> wrote:
> There's quite a big discussion of this bug somewhere hidden in the bug
> reports, i've come across the issue myself and found its rather easy to
> replicate.
>
> basically just write a loop that allocate a whole boat load of memory. run
> it till it poops on you then limit it to do a bit less iterations. that way
> the heap size will grow to very close to the top limit.
> then drop all the objects to free up the heap (you can even force a GC).
>
> wait a short while to see the heap is truely cleared, then allocate a big
> object (big enough to pass the difference between Total and Max heap size
> but smaller than the free heap space). see the world come down and say
> "WTF?"
>
> basically they check memory allocation against the total heap size instead
> of the free heap size.

Your scenario doesn't necessarily prove this claim.

Dalvik's garbage collector is a non-compacting garbage collector.
Hence, you can fragment your heap space, whereby while you have lots
of free heap, but there is no contiguous block big enough to satisfy a
particular request.

Your "loop that allocate a whole boat load of memory" is fragmenting
your heap space.

The only way that your scenario would prove your claim is if your
individual allocations in the "whole boat load of memory" are larger
than the request that then fails.

--
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 Android Development_ Version 4.6 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
--- 
You received this message because you are subscribed to the Google Groups 
"Android Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to