CMU 15213:malloc笔记和malloc实验

1. malloc笔记

在这里插入图片描述

1.1 基础概念

1.dynamic memory allocators:应用程序运行期间申请的内存(malloc)。
在这里插入图片描述
2.堆:dynamic memory allocator管理的进程内存区域
3.types of allocator:隐式分配器(new and garbage collection)和显示分配器(malloc & free)

1.2 explicit allocator

1.malloc、free、realloc
2.16-byte (x86-64) alignment on 64-bit systems
3.内部碎片产生的原因:

  • 维持堆所需的数据结构开销
  • 对齐的需要
  • 分配器实现的策略(比如,to return a big block to satisfy a small request)

4.外部碎片:Occurs when there is enough aggregate heap memory, but no single free block is large enough。(大块被划分成小块,虽然整个空闲内存能够放下程序,但是找不到单独的一块去存放)

5.keep track of free blocks:显式、隐式链表、Segregated free list(Different free lists for different size classes)、Blocks sorted by size(红黑树,长度为key)

1.2.1 隐式空闲链表

1.block structures

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值