Hot Search : Source embeded web remote control p2p game More...
Location : Home Search - allocator
Search - allocator - List
DL : 0
针对由系统调用sbrk()申请得到的内存区域进行管理,实现了用户中申请、释放内存过程。整个程序由头文件malloc.h、分配与释放模块malloc.c、应用程序test.c和工程文件makefile共四个文件组成,该程序已在linux下成功调试通过-include <unistd.h> #include "my_malloc.h" static Header base /* empty list to get started*/ static Header*free_list = NULL /* start of free list*/ /* Malloc: general-purpose storage allocator*/ void* Malloc(unsigned int nbytes) { Header*p,*prev unsigned int nunits nunits = (nbytes+ sizeof(Header)- 1)/sizeof(Header)+ 1 if ( (prev = free_list) == NULL) { /* no free list yet*/
Date : 2025-12-21 Size : 9kb User : jjl
CodeBus is one of the largest source code repositories on the Internet!
Contact us :
1999-2046 CodeBus All Rights Reserved.