summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--vm/alloc/Copying.cpp2
-rw-r--r--vm/alloc/HeapSource.cpp25
2 files changed, 11 insertions, 16 deletions
diff --git a/vm/alloc/Copying.cpp b/vm/alloc/Copying.cpp
index 77cdac33c..195670eb1 100644
--- a/vm/alloc/Copying.cpp
+++ b/vm/alloc/Copying.cpp
@@ -461,7 +461,7 @@ GcHeap *dvmHeapSourceStartup(size_t startSize, size_t absoluteMaxSize)
heapSource->allocBlocks = 0;
heapSource->totalBlocks = (heapSource->limitBlock - heapSource->baseBlock);
- assert(heapSource->totalBlocks = heapSource->maximumSize / BLOCK_SIZE);
+ assert(heapSource->totalBlocks == heapSource->maximumSize / BLOCK_SIZE);
{
size_t size = sizeof(heapSource->blockQueue[0]);
diff --git a/vm/alloc/HeapSource.cpp b/vm/alloc/HeapSource.cpp
index d1f10845d..3e5238a65 100644
--- a/vm/alloc/HeapSource.cpp
+++ b/vm/alloc/HeapSource.cpp
@@ -572,8 +572,8 @@ static void freeMarkStack(GcMarkStack *stack)
GcHeap* dvmHeapSourceStartup(size_t startSize, size_t maximumSize,
size_t growthLimit)
{
- GcHeap *gcHeap;
- HeapSource *hs;
+ GcHeap *gcHeap = NULL;
+ HeapSource *hs = NULL;
mspace msp;
size_t length;
void *base;
@@ -593,7 +593,7 @@ GcHeap* dvmHeapSourceStartup(size_t startSize, size_t maximumSize,
length = ALIGN_UP_TO_PAGE_SIZE(maximumSize);
base = dvmAllocRegion(length, PROT_NONE, "dalvik-heap");
if (base == NULL) {
- return NULL;
+ dvmAbort();
}
/* Create an unlocked dlmalloc mspace to use as
@@ -601,20 +601,19 @@ GcHeap* dvmHeapSourceStartup(size_t startSize, size_t maximumSize,
*/
msp = createMspace(base, kInitialMorecoreStart, startSize);
if (msp == NULL) {
- goto fail;
+ dvmAbort();
}
gcHeap = (GcHeap *)calloc(1, sizeof(*gcHeap));
if (gcHeap == NULL) {
LOGE_HEAP("Can't allocate heap descriptor");
- goto fail;
+ dvmAbort();
}
hs = (HeapSource *)calloc(1, sizeof(*hs));
if (hs == NULL) {
LOGE_HEAP("Can't allocate heap source");
- free(gcHeap);
- goto fail;
+ dvmAbort();
}
hs->targetUtilization = gDvm.heapTargetUtilization * HEAP_UTILIZATION_MAX;
@@ -642,32 +641,28 @@ GcHeap* dvmHeapSourceStartup(size_t startSize, size_t maximumSize,
if (!addInitialHeap(hs, msp, growthLimit)) {
LOGE_HEAP("Can't add initial heap");
- goto fail;
+ dvmAbort();
}
if (!dvmHeapBitmapInit(&hs->liveBits, base, length, "dalvik-bitmap-1")) {
LOGE_HEAP("Can't create liveBits");
- goto fail;
+ dvmAbort();
}
if (!dvmHeapBitmapInit(&hs->markBits, base, length, "dalvik-bitmap-2")) {
LOGE_HEAP("Can't create markBits");
dvmHeapBitmapDelete(&hs->liveBits);
- goto fail;
+ dvmAbort();
}
if (!allocMarkStack(&gcHeap->markContext.stack, hs->maximumSize)) {
ALOGE("Can't create markStack");
dvmHeapBitmapDelete(&hs->markBits);
dvmHeapBitmapDelete(&hs->liveBits);
- goto fail;
+ dvmAbort();
}
gcHeap->markContext.bitmap = &hs->markBits;
gcHeap->heapSource = hs;
gHs = hs;
return gcHeap;
-
-fail:
- munmap(base, length);
- return NULL;
}
bool dvmHeapSourceStartupAfterZygote()