HEAPWALK.C
资源名称:C.rar [点击查看]
上传用户:qq5388545
上传日期:2022-07-04
资源大小:29849k
文件大小:0k
源码类别:
界面编程
开发平台:
C/C++
- #include <stdio.h>
- #include <alloc.h>
- void main(void)
- {
- char *buffer1, *buffer2, *buffer3;
- struct heapinfo node = { NULL, 0, 0};
- buffer1 = malloc(100);
- buffer2 = malloc(200);
- buffer3 = malloc(300);
- free(buffer2);
- while (heapwalk(&node) == _HEAPOK)
- printf("Size %u bytes State %sn", node.size,
- (node.in_use) ? "In use": "Free");
- }