Example #1
0
jboolean initGC(Options* options) {
    GC_set_no_dls(1);
    GC_set_java_finalization(1);
    GC_INIT();
    if (options->maxHeapSize > 0) {
        GC_set_max_heap_size(options->maxHeapSize);
    }
    if (options->initialHeapSize > 0) {
        size_t now = GC_get_heap_size();
        if (options->initialHeapSize > now) {
            GC_expand_hp(options->initialHeapSize - now);
        }
    }

    objectGCKind = GC_new_kind(GC_new_free_list(), GC_MAKE_PROC(GC_new_proc(markObject), 0), 0, 1);
    largeArrayGCKind = GC_new_kind(GC_new_free_list(), GC_DS_LENGTH, 1, 1);
    atomicObjectGCKind = GC_new_kind(GC_new_free_list(), GC_DS_LENGTH, 0, 1);
    referentEntryGCKind = gcNewDirectBitmapKind(REFERENT_ENTRY_GC_BITMAP);

    if (rvmInitMutex(&referentsLock) != 0) {
        return FALSE;
    }
    if (rvmInitMutex(&gcRootsLock) != 0) {
        return FALSE;
    }

    GC_set_warn_proc(gcWarnProc);

    return TRUE;
}
Example #2
0
jboolean initGC(Options* options) {
    GC_INIT();
    GC_set_java_finalization(1);
    if (options->maxHeapSize > 0) {
        GC_set_max_heap_size(options->maxHeapSize);
    }
    if (options->initialHeapSize > 0) {
        size_t now = GC_get_heap_size();
        if (options->initialHeapSize > now) {
            GC_expand_hp(options->initialHeapSize - now);
        }
    }

    object_gc_kind = GC_new_kind(GC_new_free_list(), GC_MAKE_PROC(GC_new_proc(markObject), 0), 0, 1);

    if (rvmInitMutex(&referentsLock) != 0) {
        return FALSE;
    }

    return TRUE;
}