资源简介
资源包括:lab说明指导、lab实现代码及解析(在代码注释中)、lab笔记(note文件中)、lab注意事项等,分享给大家

代码片段和文件信息
/*
* mm-naive.c - The fastest least memory-efficient malloc package.
*
* In this naive approach a block is allocated by simply incrementing
* the brk pointer. A block is pure payload. There are no headers or
* footers. Blocks are never coalesced or reused. Realloc is
* implemented directly using mm_malloc and mm_free.
*
* NOTE TO STUDENTS: Replace this header comment with your own header
* comment that gives a high level description of your solution.
*/
#include
#include
#include
#include
#include
#include “mm.h“
#include “memlib.h“
/*********************************************************
* NOTE TO STUDENTS: Before you do anything else please
* provide your team information in the following struct.
********************************************************/
team_t team = {
/* Your student_id */
“16307130350“
/* Your full name */
“王明霞“
/* Your email address */
“16307130350@fudan.edu.cn“
/* leave blank */
““
/* leave blank */
““
};
/* single word (4) or double word (8) alignment */
#define ALIGNMENT 8
/* rounds up to the nearest multiple of ALIGNMENT */
#define ALIGN(size) (((size) + (ALIGNMENT-1)) & ~0x7)
#define SIZE_T_SIZE (ALIGN(sizeof(size_t)))
#define WSIZE 4
#define DSIZE 8
#define CHUNKSIZE (1<<12) //extend heap by this amount(bytes)
#define MAX(xy) ((x)>(y)?(x):(y))
#define PACK(sizealloc) ((size) | (alloc)) //pack a size and allocated bit into a word
#define GET(p) (*(unsigned int *)(p)) //read and write a word at address p
#define PUT(pval) (*(unsigned int *)(p) = (val))
#define GET_SIZE(p) (GET(p) & ~0x7)
#define GET_ALLOC(p) (GET(p) & 0x1)
#define HDRP(bp) ((char *)(bp)-WSIZE)
#define FTRP(bp) ((char *)(bp)+GET_SIZE(HDRP(bp))-DSIZE) /*合并方式采取带边界标记的合并*/
/* Compute address of next and previous blocks*/
#define NEXT_BLKP(bp) ((char *)(bp)+GET_SIZE(((char *)(bp)-WSIZE)))
#define PREV_BLKP(bp) ((char *)(bp)-GET_SIZE(((char *)(bp)-DSIZE)))
#define PREV_linkNODE_RP(bp) ((char*)(bp)) /*bp的前一个node:pred*/
#define NEXT_linkNODE_RP(bp) ((char*)(bp)+WSIZE) /*bp的后一个node:succ*/
static void *extend_heap(size_t words);
static void *coalesce(void *bp);
inline char *find_free_list_header(size_t size);
inline void delete_from_list(char *p);
inline void insert_to_link(char *p);
static void place(void *bpsize_t asize);
static void* find_fit(size_t size);
void* memcpy_new(void *Dest const void *Src size_t Count);
static void *realloc_coalesce(void *bp size_t newSize int *bp_not_change);
static void realloc_place(void *bpsize_t asize);
static char *heap_listp = NULL;
static char *free_list_start = NULL;
/*
* mm_init - initialize the malloc package.
*/
int mm_init(void){
if((heap_listp = mem_sbrk(14*WSIZE))==(void *)-1) //使用mem_sbrk请求额外的堆处理器
return -1;
/* 使用简单分离存储 */
PUT(heap_
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2018-11-06 11:46 malloclab全套资料及参考答案\
文件 77983 2018-11-06 11:39 malloclab全套资料及参考答案\malloclab.pdf
文件 14110 2018-11-06 11:39 malloclab全套资料及参考答案\mm_5.0.c
文件 16401 2018-11-06 11:39 malloclab全套资料及参考答案\mm_best_untilnow.c
文件 2423 2018-11-06 11:39 malloclab全套资料及参考答案\mm_initial (2).c
文件 883371 2018-11-06 11:40 malloclab全套资料及参考答案\report.docx
文件 13238 2018-11-06 11:39 malloclab全套资料及参考答案\standard.c
相关资源
- MODERN ROBOTICS MECHANICS PLANNING AND CONTROL
- Fabrication and all-optical poling characteris
- Game Physics Engine Development
- 千锋elasticsearch视频教程带笔记
-
Temporal-ba
sed Multi-Strokes Sketchy Graphi - Polarization Optics in Telecommunication
- ConcreteMathematics2nd.pdf
- Qt图片浏览器 --基于Qt的Graphics View f
- Mentor Graphics Expedition Enterprise v7.9.5.r
- Graphics Magic图像处理魔术师,含Delph
- es(elasticsearch)整合SpringCloudSpringBo
- Impact of bond order loss on surface and nanos
- 基于COMSOL Multiphysics的掏穴增透技术应
- STM32F103VCT6TR - High-density performance lin
- Geometrical methods in robotics
- The advanced theory of statistics1945)
- 游戏物理引擎开发&源代码.zip
- Effects of L-type Matching Network on Characte
- synaptics触摸板插入USB外接鼠标后自动
- Bioinformatics analysis of tyrosinase-related
- STMicroelectronics 所有封装集成库intlib格
- BricsysBricsCadPlatiniumv17.2.12.1Linux64位免费
- 《TheArtofElectronics》电子学第二版吴利
- Smoothed Particle Hydrodynamics A Meshfree Par
- 中国银联IC卡技术规范UICS2017
- 接触力学,名师Johnson写的书!中文版
- kinetics600.tar.gz
- 空气动力学资料合集.Anderson.Fundament
- 赤裸裸的统计学_Naked_Statistics_Strippi
- Race Car Vehicle Dynamics
评论
共有 条评论