Skip to content
bjourne edited this page Sep 5, 2014 · 5 revisions

FAQ about the free lists.

What is a free list allocator?

Factor contains two different memory allocators, a bump allocator and a free list allocator. The free list allocator is used when it is unwise to move the allocated objects, for example when allocating code blocks. It's much more complicated than the bump allocator, but its big advantage is that objects in it can be freed outside of a gc cycle.

Both the code and data heap has a free list allocator. The data heaps one is an instance of tenured_space. Each free list allocator has a free_list tied to itself.

What does the state for a free list allocator handle?

The state is a mark_bits instance. It probably flags blocks as either live or garbage. Its size and start attributes has the same interpretation and value as the one in the free_list_allocator that owns it.

What is the meaning of the free list allocators attributes?

size
Size in bytes of the allocator.
start
Address to the first writable byte of the segment this allocator manages.
end
Should always be start + size, shouldn't it?

About Free Lists

Free Lists contains 32 (free_list_count) vectors which all empty when the object is instantiated. Then one free_heap_block is created which encompasses the whole segment the free list works on. The heap block is placed in the large_blocks set because it is so big.

What is a free heap block?`