Ejemplo n.º 1
0
static void
init_nursery (SgenFragmentAllocator *allocator, char *start, char *end)
{
	char *middle = start + (end - start) / 2;
	sgen_fragment_allocator_add (allocator, start, middle);
	sgen_fragment_allocator_add (&collector_allocator, middle, end);

	promotion_barrier = middle;
}
Ejemplo n.º 2
0
static void
init_nursery (SgenFragmentAllocator *allocator, char *start, char *end)
{
	int alloc_quote = (int)((end - start) * alloc_ratio);
	promotion_barrier = align_down (start + alloc_quote, 3);
	sgen_fragment_allocator_add (allocator, start, promotion_barrier);
	sgen_fragment_allocator_add (&collector_allocator, promotion_barrier, end);

	region_age_size = (end - start) >> SGEN_TO_SPACE_GRANULE_BITS;
	region_age = g_malloc0 (region_age_size);
}
Ejemplo n.º 3
0
/*
 * We found a fragment of free memory in the nursery: memzero it and if
 * it is big enough, add it to the list of fragments that can be used for
 * allocation.
 */
static void
add_nursery_frag (SgenFragmentAllocator *allocator, size_t frag_size, char* frag_start, char* frag_end)
{
	SGEN_LOG (4, "Found empty fragment: %p-%p, size: %zd", frag_start, frag_end, frag_size);
	binary_protocol_empty (frag_start, frag_size);
	/* Not worth dealing with smaller fragments: need to tune */
	if (frag_size >= SGEN_MAX_NURSERY_WASTE) {
		/* memsetting just the first chunk start is bound to provide better cache locality */
		if (sgen_get_nursery_clear_policy () == CLEAR_AT_GC)
			memset (frag_start, 0, frag_size);
		else if (sgen_get_nursery_clear_policy () == CLEAR_AT_TLAB_CREATION_DEBUG)
			memset (frag_start, 0xff, frag_size);

#ifdef NALLOC_DEBUG
		/* XXX convert this into a flight record entry
		printf ("\tfragment [%p %p] size %zd\n", frag_start, frag_end, frag_size);
		*/
#endif
		sgen_fragment_allocator_add (allocator, frag_start, frag_end);
		fragment_total += frag_size;
	} else {
		/* Clear unused fragments, pinning depends on this */
		sgen_clear_range (frag_start, frag_end);
		HEAVY_STAT (stat_wasted_bytes_small_areas += frag_size);
	}
}
Ejemplo n.º 4
0
static void
init_nursery (SgenFragmentAllocator *allocator, char *start, char *end)
{
	sgen_fragment_allocator_add (allocator, start, end);
}