91av视频/亚洲h视频/操亚洲美女/外国一级黄色毛片 - 国产三级三级三级三级

  • 大小: 901KB
    文件類型: .rar
    金幣: 2
    下載: 0 次
    發布日期: 2021-06-08
  • 語言: 其他
  • 標簽: hit??csapp??

資源簡介

哈工大計算機系統實驗八動態內存分配器 實驗報告和代碼

資源截圖

代碼片段和文件信息

/*
?*?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?=?{
????/*?Team?name?*/
????“weixiaowen“
????/*?First?member‘s?full?name?*/
????“weixiaowen“
????/*?First?member‘s?email?address?*/
????“706461857@qq.com“
????/*?Second?member‘s?full?name?(leave?blank?if?none)?*/
????““
????/*?Second?member‘s?email?address?(leave?blank?if?none)?*/
????““
};


/*?$begin?mallocmacros?*/
/*?Basic?constants?and?macros?*/
#define?WSIZE???????4???????/*?word?size?(bytes)?*/??
#define?DSIZE???????8???????/*?doubleword?size?(bytes)?*/
#define?CHUNKSIZE??(1<<12)??/*?initial?heap?size?(bytes)?*/
#define?OVERHEAD????8???????/*?overhead?of?header?and?footer?(bytes)?*/

#define?MAX(x?y)?((x)?>?(y)??(x)?:?(y))??

/*?Pack?a?size?and?allocated?bit?into?a?word?*/
#define?PACK(size?alloc)??((size)?|?(alloc))

/*?Read?and?write?a?word?at?address?p?*/
#define?GET(p)???????(*(size_t?*)(p))
#define?PUT(p?val)??(*(size_t?*)(p)?=?(val))??

/*?Read?the?size?and?allocated?fields?from?address?p?*/
#define?GET_SIZE(p)??(GET(p)?&?~0x7)
#define?GET_ALLOC(p)?(GET(p)?&?0x1)

/*?Given?block?ptr?bp?compute?address?of?its?header?and?footer?*/
#define?HDRP(bp)???????((char?*)(bp)?-?WSIZE)??
#define?FTRP(bp)???????((char?*)(bp)?+?GET_SIZE(HDRP(bp))?-?DSIZE)

/*?Given?block?ptr?bp?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)))
/*?$end?mallocmacros?*/

/*?Global?variables?*/
static?char?*heap_listp;??/*?pointer?to?first?block?*/??
#ifdef?NEXT_FIT
static?char?*rover;???????/*?next?fit?rover?*/
#endif

/*?function?prototypes?for?internal?helper?routines?*/
static?void?*extend_heap(size_t?words);
static?void?place(void?*bp?size_t?asize);
static?void?*find_fit(size_t?asize);
static?void?*coalesce(void?*bp);
static?void?printblock(void?*bp);?
static?void?checkblock(void?*bp);

/*?
?*?mm_init?-?Initialize?the?memory?manager?
?*/
/*?$begin?mminit?*/
int?mm_init(void)?
{
????/*?create?the?initial?empty?heap?*/
????if?((heap_listp?=?mem_sbrk(4*WSIZE))?==?NULL)
return?-1;
????PUT(heap_listp?0);????????????????????????/*?alignment?padding?*/
????PUT(heap_listp+WSIZE?P

?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----

?????文件?????792556??2018-12-24?23:14??計算機系統1170500704魏孝文\1170500704魏孝文.pdf

?????文件?????273920??2018-12-24?23:13??計算機系統1170500704魏孝文\HITICS-lab8實驗報告1170500704魏孝文.doc

?????文件???????9356??2018-12-11?21:23??計算機系統1170500704魏孝文\mm.c

?????目錄??????????0??2018-12-25?21:26??計算機系統1170500704魏孝文

-----------?---------??----------?-----??----

??????????????1075832????????????????????4


評論

共有 條評論