free list
{{Short description|Data structure used for memory allocation}}
{{No footnotes|date=November 2021}}
A free list (or freelist) is a data structure used in a scheme for dynamic memory allocation. It operates by connecting unallocated regions of memory together in a linked list, using the first word of each unallocated region as a pointer to the next. It is most suitable for allocating from a memory pool, where all objects have the same size.
Free lists make the allocation and deallocation operations very simple. To free a region, one would just link it to the free list. To allocate a region, one would simply remove a single region from the end of the free list and use it. If the regions are variable-sized, one may have to search for a region of large enough size, which can be expensive.
Free lists have the disadvantage, inherited from linked lists, of poor locality of reference and so poor data cache utilization, and they do not automatically consolidate adjacent regions to fulfill allocation requests for large regions, unlike the buddy allocation system. Nevertheless, they are still useful in a variety of simple applications where a full-blown memory allocator is unnecessary or requires too much overhead.
The OCaml runtime uses free lists to satisfy allocation requests,{{cite book |title = Real World OCaml |first1 = Yaron |last1 = Minsky |first2 = Anil |last2 = Madhavapeddy |date = October 2022 |publisher = Cambridge University Press |edition = 2nd |chapter = Understanding the Garbage Collector |chapter-url = https://dev.realworldocaml.org/garbage-collector.html |access-date = 8 November 2022}} as does RosAlloc on Android Runtime.{{cite web |title=Debugging ART garbage collection |url=https://source.android.com/docs/core/runtime/gc-debug |access-date=16 Feb 2023 |archive-url=https://archive.today/20230216224658/https://source.android.com/docs/core/runtime/gc-debug |archive-date=16 Feb 2023 |website=source.android.com }}
See also
References
{{reflist}}
=Further reading=
- [http://www.memorymanagement.org/glossary/f.html#free.list The Memory Management Glossary]
- [http://www.cs.nyu.edu/faculty/davise/pl/Memory%20Allocation.ppt Memory Allocation Lecture Slides (ppt)]
{{operating-system-stub}}