当前位置:网站首页>Chapter 17 free space management
Chapter 17 free space management
2022-06-13 04:56:00 【CCSUZB】
The problems to be solved in this chapter are :
To meet variable length allocation requests , How to manage free space ? What strategies can minimize fragmentation ? How about the time and space cost of different methods ?
17.1 hypothesis
A data structure that manages free space on the heap is often called a free list (free list). This structure contains references that manage all free blocks in the memory area .
17.2 Underlying mechanism
- Split and merge
- Track the size of allocated space
- Embed free list
- Let the heap grow
17.3 Basic strategy
- The best match : First, traverse the entire free list , Find a free block of the same or larger size as the request , And then go back to the smallest one in the group .
- The worst match :, It tries to find the largest free block , After segmenting and meeting user needs , Put the remaining blocks ( It's big ) Join the free list
- Match for the first time : Find the first big enough block , Return the requested space to the user
- Next time match : A pointer , Point to where the last lookup ended
17.4 The other way
Detach the free list : If an application frequently applies for one ( Or several ) Size of memory space , So use a separate list , Only manage objects of this size . Requests of other sizes are allocated to more general memory allocators
Buddy system : In this system , Free space is first conceptually considered to be the size of 2N The big space . When there is a memory allocation request , Free space is recursively split in two , Until it just meets the size of the request ( It's not enough to divide into two ). At this time , The requested block is returned to the user .
边栏推荐
猜你喜欢
Advanced C - Section 2 - pointers
Section 3 - functions
Reductive elimination
Hidden implementation and decoupling, knowing Pimpl mode
Section 4 - arrays
Interpretation of QT keypressevent
Shell built-in string substitution
Mysql8.0.13 installation tutorial (with pictures)
Section 7 - structures
Internet people a few years ago vs Internet people today
随机推荐
Third party comment plugin
Basic syntax example for go
promise处理js多线程全部获得结果后同一处理结果
QT realizes message sending and file transmission between client and server
Trust programming - linked lists: use struct to implement linked lists, use heap to merge K ascending linked lists, and customize display
Section 3 - functions
Colab tutorial (super detailed version) and colab pro/pro+ evaluation
Section 8 - Practical commissioning techniques
Red Treasure Book Reading Notes (continuously updated)
CMB's written test -- data analysis
2021tami/ image processing: exploiting deep generative priority for versatile image restoration and manipulation
Your one-on-one meetings are inefficient. You can do this!
Collection of some compatibility issues
Advanced C language - Section 1 - data storage
第三方评论插件
Spice story
E - Lucky Numbers
2022年建筑架子工(建筑特殊工种)特种作业证考试题库及在线模拟考试
QT brushes and brushes
Createanonymousthreadx passes parameters to anonymous threads