library/src/mmap/BP-MMapSlabAllocator.cc
// walk through the allocator and find contiguous set of slabs
walk through the allocator and find contiguous set of slabs
walk through the allocator and find contiguous set of slabs
BP_SLAB_ALLOCATOR_ITER_LOOP_ALL(allocator)
	{
		if
		(
			BP_FLAG_IS_SET(allocator->curr_entry->flags, BP_MMAP_SLAB_ENTRY_INFO_AVAILABLE)
		)
		{
			available_adjacent_n = BP_SlabAllocAvailableAdjacentEntries
			(
					allocator,
					allocator->curr_entry
			);
			if(available_adjacent_n >= num_entries)
			{
				printf("\n [+] Preparing for allocation (%u - %u)", available_adjacent_n, num_entries);
				ret_entry = allocator->curr_entry;
				BP_SlabAllocCheckoutEntries
				(
					allocator,
					allocator->curr_entry,
					num_entries
				);
				allocator->curr_entry = ret_entry;
				break;
			}
		}
		available_adjacent_n = 0;
	}
BP_SLAB_ALLOCATOR_ITER_LOOP_ALL ( allocator ) { if ( BP_FLAG_IS_SET ( allocator -> curr_entry -> flags , BP_MMAP_SLAB_ENTRY_INFO_AVAILABLE ) ) { available_adjacent_n = BP_SlabAllocAvailableAdjacentEntries ( allocator , allocator -> curr_entry ) ; if ( available_adjacent_n >= num_entries ) { printf ( " \n " , available_adjacent_n , num_entries ) ; ret_entry = allocator -> curr_entry ; BP_SlabAllocCheckoutEntries ( allocator , allocator -> curr_entry , num_entries ) ; allocator -> curr_entry = ret_entry ; break ; } } available_adjacent_n = 0 ; }
walk through the allocator and find contiguous set of slabs
walk through the allocator and find contiguous set of slabs
// if the current slab has never been allocated, indicate that here // count the number of adjacent items // available adjacent number of entries // set the return entry // attempt to check out the chunks // reset the current entry pointer // break after allocation // reset the adjacent item count