当前位置:网站首页>Memory pool principle I (based on the whole block)
Memory pool principle I (based on the whole block)
2022-06-10 18:05:00 【QQ851301776】
Created by QQ:851301776, mailbox :[email protected], Welcome to technical exchange , This blog is mainly my own learning experience , Just to make a little progress every day !
Personal motto :
1. No one was born , As long as it is thick, it will happen .
2. You can have a low degree , You can skip school , But you have to learn
One 、 Memory pool design ideas
1. Memory pool solves the problem (malloc/free)
(1) Not conducive to memory management
(2) Memory fragmentation is severe
(3) Programs are prone to memory leaks , Eventually a memory overflow occurs
2. Memory pool design practices (4K)
(1) Partner algorithm
Distribute : hold 4K, according to 2 Of n Power method , from 0 Begin to assign to :1/2/4/8/16/32/64/128/256/512/1K/2K These pieces , Core thinking : Turn the whole block into pieces
Use : Such as the need to 129 Bytes : It will 256 This block is split again into :128/64/32/16/8/4/2/1,
Merge : Combine two adjacent pieces of the same size , With the next piece . The first condition is that two blocks are adjacent , The second condition is that the two pieces must be the same size .
Release : Turn small pieces into big ones , Unified release
(2)slab
No explanation here , You can see nginx Use slab Memory pool part of (slab The core is to : For example, a 4K Page of , All become 4/8/16( Numbers are just examples ), This small piece )
边栏推荐
猜你喜欢
随机推荐
Nacos configuration management
高数_第6章无穷级数__正项级数的性质
numpy——记录
《华为数据之道》读书笔记
领导提拔你的原因,只有这点最真实,其他都是瞎扯!
训练时添加进度条的库--tqdm
Abbexa丙烯酰胺-PEG-NHS说明书
Penguin E-sports stops, and tiger teeth are hard to walk
JS blur shadow follow animation JS special effect plug-in
Lifeifei: I am more like a scientist in physics than an engineer
sense of security
Some views on the current CIM (bim+gis) industry
Classic topics of leetcode tree (I)
Flutter在数字生活的发展与天翼云盘落地实践
图像搜索是什么
牛客网:表达式求值
THE LOTTERY TICKET HYPOTHESIS: FINDING SPARSE, TRAINABLE NEURAL NETWORKS论文笔记
Leetcode 875. Coco, who likes bananas
美学心得(第二百三十七集) 罗国正
Leetcode 929. 独特的电子邮件地址









