OSDN Git Service

Use the break position of the current mspace for sizing the zygote heap.
authorCarl Shapiro <cshapiro@google.com>
Mon, 11 Oct 2010 01:50:22 +0000 (18:50 -0700)
committerCarl Shapiro <cshapiro@google.com>
Mon, 11 Oct 2010 01:50:51 +0000 (18:50 -0700)
commit88c57e189ecf7d5ed64d1073a37839b250874aa5
treeb9ec414307e54cdec483183676dc96cc8ef6b6b9
parent7d3f633d2c0061e579c57186276c05ddcc275641
Use the break position of the current mspace for sizing the zygote heap.

Previously, the mspace footprint used the "overhead" of a heap which
underestimates the size of the zygote heap by 16 bytes, the specific
size of a descriptor deposited at the start of an mspace containing
the control information about that mspace.  If a heap is a multiple of
a page or within 15 bytes of it, the size of the new heap would be
underestimated.

Bad things happened when this underestimate was used to create an
application heap.  The starting address of the application heap was
based on a correctly computed value instead of the underestimate.
This caused the application heap to be one page to large and end one
page beyond where it should.  This additional page happened to overlap
the first page one of the heap bitmaps.  Furthermore, the mspace
routine would proceed access protect that page thinking it was unused
free space.  During the next GC reads to the first page of the bitmap
would generate a SIGSEGV.

By using the break position, correctly rounded, for all sizing
computations this problem no longer exists.

Change-Id: Icb3c82731e589747e8e4cf16d0797052e64b3ad5
vm/alloc/HeapSource.c