- 论坛徽章:
- 4
|
Allocation algo.
When user requests some memory regiosn, it’s size is rounded upto minimum allocation size (instead of power of two in SLAB) and appropriate entry in array of lists of free chunks is selected. If that list contains free elements, first one is returned, otherwise next list is selected with bigger size until on-empty list is found.
Then allocator determines a node for appropriate chunk (using fields in corresponding struct age->lru), and bits corresponding to selected chunk are marked as used. If chunk had bigger size than requested, the rest is placed back into the list for appropriate size.
Thus allocator gets requested memory aligned to minimum allocation size.
感觉这个跟tree没关系。。。奇怪! |
|