If I understand you correctly, check this link:
Temporary memory allocation complexity
Heap allocation can be done by presenting free memory as a linked list, but any reasonably sophisticated memory manager will use something faster, like the AVL tree mentioned in the answer in the question I posted. There is even an O (1) solution called TLSF (Two Level Segregated Fit), also mentioned in the answer.
source share