⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 alloc.3

📁 UNIX v6源代码 这几乎是最经典的unix版本 unix操作系统设计和莱昂氏unix源代码分析都是用的该版
💻 3
字号:
.th ALLOC III 3/1/74.sh NAMEalloc, free \*- core allocator.sh SYNOPSIS.ft B.nfchar *alloc(size).s3free(ptr)char *ptr;.fi.ft R.sh DESCRIPTION.it Allocand.it freeprovide a simple general-purpose core management package..it Allocis given a size in bytes; it returns a pointerto an area at least that size whichis even and hence can hold an object of any type.The argument to.it freeis a pointer to an area previously allocated by.it alloc;this space is made available for further allocation..s3Needless to say, grave disorder will result if the spaceassigned by.it allocis overrun or if some random number is handed to.it free..s3The routine uses a first-fit algorithm whichcoalesces blocks being freed with otherblocks already free.It calls.it sbrk(see.it "break (II))"to get more core from the system when there is nosuitable space already free..sh DIAGNOSTICSReturns \*-1 if there is no available core..sh BUGSAllocated memory contains garbageinstead of being cleared.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -