コード例 #1
0
ファイル: sgen-internal.c プロジェクト: LogosBible/mono
void
sgen_init_internal_allocator (void)
{
	int i, size;

	for (i = 0; i < INTERNAL_MEM_MAX; ++i)
		fixed_type_allocator_indexes [i] = -1;

	for (i = 0; i < NUM_ALLOCATORS; ++i) {
		allocator_block_sizes [i] = block_size (allocator_sizes [i]);
		mono_lock_free_allocator_init_size_class (&size_classes [i], allocator_sizes [i], allocator_block_sizes [i]);
		mono_lock_free_allocator_init_allocator (&allocators [i], &size_classes [i], MONO_MEM_ACCOUNT_SGEN_INTERNAL);
	}

	for (size = mono_pagesize (); size <= LOCK_FREE_ALLOC_SB_MAX_SIZE; size <<= 1) {
		int max_size = (LOCK_FREE_ALLOC_SB_USABLE_SIZE (size) / 2) & ~(SIZEOF_VOID_P - 1);
		/*
		 * we assert that allocator_sizes contains the biggest possible object size
		 * per block which has to be an aligned address.
		 * (4K => 2040, 8k => 4088, 16k => 8184 on 64bits),
		 * so that we do not get different block sizes for sizes that should go to the same one
		 */
		g_assert (allocator_sizes [index_for_size (max_size)] == max_size);
		g_assert (block_size (max_size) == size);
		if (size < LOCK_FREE_ALLOC_SB_MAX_SIZE)
			g_assert (block_size (max_size + 1) == size << 1);
	}
}
コード例 #2
0
ファイル: sgen-internal.c プロジェクト: tigerhu67/mono
void
sgen_init_internal_allocator (void)
{
	int i;

	for (i = 0; i < INTERNAL_MEM_MAX; ++i)
		fixed_type_allocator_indexes [i] = -1;

	for (i = 0; i < NUM_ALLOCATORS; ++i) {
		mono_lock_free_allocator_init_size_class (&size_classes [i], allocator_sizes [i]);
		mono_lock_free_allocator_init_allocator (&allocators [i], &size_classes [i]);
	}
}
コード例 #3
0
ファイル: sgen-internal.c プロジェクト: Profit0004/mono
void
sgen_init_internal_allocator (void)
{
    int i, size;

    for (i = 0; i < INTERNAL_MEM_MAX; ++i)
        fixed_type_allocator_indexes [i] = -1;

    for (i = 0; i < NUM_ALLOCATORS; ++i) {
        allocator_block_sizes [i] = block_size (allocator_sizes [i]);
        mono_lock_free_allocator_init_size_class (&size_classes [i], allocator_sizes [i], allocator_block_sizes [i]);
        mono_lock_free_allocator_init_allocator (&allocators [i], &size_classes [i]);
    }

    for (size = mono_pagesize (); size <= LOCK_FREE_ALLOC_SB_MAX_SIZE; size <<= 1) {
        int max_size = LOCK_FREE_ALLOC_SB_USABLE_SIZE (size) / 2;
        /*
         * we assert that allocator_sizes contains the biggest possible object size
         * per block (4K => 4080 / 2 = 2040, 8k => 8176 / 2 = 4088, 16k => 16368 / 2 = 8184 on 64bits),
         * so that we do not get different block sizes for sizes that should go to the same one
         */
        g_assert (allocator_sizes [index_for_size (max_size)] == max_size);
    }
}