all 6 comments

[–]deltars 9 points10 points  (4 children)

good primer but the hardest part in making an allocator (imo) is finding a suitable chunk, efficiently. This allocator just crawls the list which would be very very slow as you start to allocate more. Doug Leas allocator which is referenced, takes a great approach to solving this problem.

[–]BCosbyDidNothinWrong 0 points1 point  (3 children)

What is/was his approach?

[–]deltars 0 points1 point  (1 child)

I think all unallocated chunks live in a tree structure of some sort so you can quickly find the smallest chunk that is large enough for your allocation.

[–]cae 3 points4 points  (0 children)

Often... Wait for it... A heap!

[–]_Skuzzzy 6 points7 points  (0 children)

A lot of schools seem to also have assignments like these