Пример #1
0
void*
sgen_alloc_internal_dynamic (size_t size, int type, gboolean assert_on_failure)
{
	int index;
	void *p;

	if (size > allocator_sizes [NUM_ALLOCATORS - 1]) {
		p = sgen_alloc_os_memory (size, (SgenAllocFlags)(SGEN_ALLOC_INTERNAL | SGEN_ALLOC_ACTIVATE), NULL, MONO_MEM_ACCOUNT_SGEN_INTERNAL);
		if (!p)
			sgen_assert_memory_alloc (NULL, size, description_for_type (type));
	} else {
		index = index_for_size (size);

#ifdef HEAVY_STATISTICS
		++ allocator_sizes_stats [index];
#endif

		p = mono_lock_free_alloc (&allocators [index]);
		if (!p)
			sgen_assert_memory_alloc (NULL, size, description_for_type (type));
		memset (p, 0, size);
	}

	SGEN_ASSERT (0, !(((mword)p) & (sizeof(gpointer) - 1)), "Why do we allocate unaligned addresses ?");
	return p;
}
Пример #2
0
void*
sgen_alloc_internal (int type)
{
	int index = fixed_type_allocator_indexes [type];
	void *p;
	g_assert (index >= 0 && index < NUM_ALLOCATORS);
	p = mono_lock_free_alloc (&allocators [index]);
	memset (p, 0, allocator_sizes [index]);
	return p;
}
Пример #3
0
void*
sgen_alloc_internal (int type)
{
	int index = fixed_type_allocator_indexes [type];
	int size = allocator_sizes [index];
	void *p;
	g_assert (index >= 0 && index < NUM_ALLOCATORS);
	p = mono_lock_free_alloc (&allocators [index]);
	memset (p, 0, size);

	MONO_GC_INTERNAL_ALLOC ((mword)p, size, type);

	return p;
}
Пример #4
0
void*
sgen_alloc_internal_dynamic (size_t size, int type)
{
    int index;
    void *p;

    if (size > allocator_sizes [NUM_ALLOCATORS - 1])
        return sgen_alloc_os_memory (size, TRUE);

    index = index_for_size (size);

    p = mono_lock_free_alloc (&allocators [index]);
    memset (p, 0, size);
    return p;
}
Пример #5
0
void*
sgen_alloc_internal (int type)
{
    int index, size;
    void *p;

    index = fixed_type_allocator_indexes [type];
    g_assert (index >= 0 && index < NUM_ALLOCATORS);

#ifdef HEAVY_STATISTICS
    ++ allocator_sizes_stats [index];
#endif

    size = allocator_sizes [index];

    p = mono_lock_free_alloc (&allocators [index]);
    memset (p, 0, size);

    return p;
}
Пример #6
0
void*
sgen_alloc_internal_dynamic (size_t size, int type, gboolean assert_on_failure)
{
	int index;
	void *p;

	if (size > allocator_sizes [NUM_ALLOCATORS - 1]) {
		p = sgen_alloc_os_memory (size, SGEN_ALLOC_INTERNAL | SGEN_ALLOC_ACTIVATE, NULL);
		if (!p)
			sgen_assert_memory_alloc (NULL, description_for_type (type));
		return p;
	}

	index = index_for_size (size);

	p = mono_lock_free_alloc (&allocators [index]);
	if (!p)
		sgen_assert_memory_alloc (NULL, description_for_type (type));
	memset (p, 0, size);
	return p;
}
Пример #7
0
void*
sgen_alloc_internal (int type)
{
	int index, size;
	void *p;

	index = fixed_type_allocator_indexes [type];
	g_assert (index >= 0 && index < NUM_ALLOCATORS);

#ifdef HEAVY_STATISTICS
	++ allocator_sizes_stats [index];
#endif

	size = allocator_sizes [index];

	p = mono_lock_free_alloc (&allocators [index]);
	memset (p, 0, size);

	SGEN_ASSERT (0, !(((mword)p) & (sizeof(gpointer) - 1)), "Why do we allocate unaligned addresses ?");

	return p;
}
Пример #8
0
void*
sgen_alloc_internal_dynamic (size_t size, int type, gboolean assert_on_failure)
{
    int index;
    void *p;

    if (size > allocator_sizes [NUM_ALLOCATORS - 1]) {
        p = sgen_alloc_os_memory (size, (SgenAllocFlags)(SGEN_ALLOC_INTERNAL | SGEN_ALLOC_ACTIVATE), NULL);
        if (!p)
            sgen_assert_memory_alloc (NULL, size, description_for_type (type));
    } else {
        index = index_for_size (size);

#ifdef HEAVY_STATISTICS
        ++ allocator_sizes_stats [index];
#endif

        p = mono_lock_free_alloc (&allocators [index]);
        if (!p)
            sgen_assert_memory_alloc (NULL, size, description_for_type (type));
        memset (p, 0, size);
    }
    return p;
}