资源简介
采用seg-list结构,易于理解,适合和我一样的弱渣使用,好好调参,可以得到93分,我觉得可以接受
代码片段和文件信息
/*
ID:1600011090 NAME:Chen HaoRan
MIAN IDEA:
I use the seglist to complete it
First i store 40 pointers in the heap free_head[20]
in which free_head[i] is the head pointer of the rank
i free_listeach list will contain the size of [2^i2^(i+1)
block.
Then the free_tail[20] pointer to the tail of 20 free_
list.
For mallocingi use the first_fit to find a place in the
suitable listby testing we now it can get most scores.Then
delete it from the free_list.
For freeingi just add it to the free_list.
For coalescingdelete the neiborhood free blocks from the
listcombine themadd it to the free_list again.
Reallock function should tell the rank of the oldsize and
and the newsize to determine whether we should copy the data from
old place to a new place.
*/
#include
#include
#include
#include
#include
#include “mm.h“
#include “memlib.h“
/* If you want debugging output use the following macro. When you hand
* in remove the #define DEBUG line. */
//#define DEBUG
#ifdef DEBUG
# define dbg_printf(...) printf(__VA_ARGS__)
#else
# define dbg_printf(...)
#endif
/* do not change the following! */
#ifdef DRIVER
/* create aliases for driver tests */
#define malloc mm_malloc
#define free mm_free
#define realloc mm_realloc
#define calloc mm_calloc
#endif /* def DRIVER */
/*
the macro below is what i will use in the program
the meaning of them are easy to tell by their names
*/
#define WSIZE 4
#define DSIZE 8
#define BLOCKSIZE 16
#define INFOSIZE 8
#define CHUNKSIZE 0x150
#define MAX(x y) ((x) > (y)? (x) : (y))
#define ALIGNMENT 8
#define ALIGN(size) (((size_t)(size) + (ALIGNMENT - 1)) & ~0x7)
#define PACK(size alloc) ((size) | (alloc))
#define GET(p) (*(unsigned int *)(p))
#define PUT(p val) (*(unsigned int *)(p) = (val))
#define GET_SIZE(p) (GET(p) & ~0x7)
#define GET_ALLOC(p) (GET(p) & 0x1)
#define HEAD(bp) ((char *)(bp) - WSIZE)
#define FOOT(bp) ((char *)(bp) + GET_SIZE(HEAD(bp)) - DSIZE)
#define NEXT_BLKP(bp) ((char *)(bp) + GET_SIZE(((char *)(bp) - WSIZE)))
#define PREV_BLKP(bp) ((char *)(bp) - GET_SIZE(((char *)(bp) - DSIZE)))
#define SIZE(bp) (GET_SIZE(HEAD(bp)))
#define PREV_SIZE(bp) (GET_SIZE((char *)(bp) - DSIZE))
#define NEXT_SIZE(bp) (GET_SIZE((char *)(bp) + SIZE(bp) - WSIZE))
#define ALLOC(bp) (GET_ALLOC(HEAD(bp)))
#define FATHER(bp) ((char *)(bp) - GET(bp))
#define CHILD(bp) ((char *)(bp) + GET((char *)(bp) + WSIZE))
#define PUT_FATHER(bp pre) PUT(bp (unsigned int)((char *)(bp) - (char *)(pre)))
#define PUT_CHILD(bp suc) PUT((char *)(bp) + WSIZE (unsigned int)((char *)(suc) - (char *)(bp)))
#define ALLNULL 0
#define HEADNULL 1
#define TAILNULL 2
#define NORMAL 3
/*
here are the global variablepoint to the heapfree_list‘s
headfree_list‘s tail
相关资源
- csapp proxy lab 满分原创北大&cmu; 仅供
- 基于蒙特卡罗法2FSK系统抗噪声性能仿
- 莱斯衰落信道仿真
- 运动目标波门跟踪
- 两类label(01)的MNIST数据集
- 基于labview的dtmf信号生成及麦克风
- K-modes算法 随机类中心
- 基于LabVIEW的摄像头视频图像实时采集
- Labview读取Excel表格到数组中,并获取
- 基于LABVIEW 的室温采集系统
- 基于Labview的虚拟示波器的实现
- Labview控制多个马达程序
- 多标签(multi-label)数据问题常用的分
- 基于labview的一个简单的多信号发生器
- 无线通信系统仿真
- labview制作的模拟钢琴
- 自适应波束形成的基本程序
- labview 10进制字符串强制转换为16进制
- LabVIEW数据采集210715
- BCH编译码MALAB
- Labview编程 简单登陆界面
- Labview的UDP发送与接收程序
- 最大流/最小割的push-relabel算法的代码
- labview电梯小程序课程设计
- labview声音信号处理
- Labview操作者框架AF的kvaser应用
- QPSK卷积码程序
- lombscargle.m
- 鲁棒控制在飞翼无人机控制律设计中
- 瑞利莱斯对数正态分布仿真
评论
共有 条评论