allocer.c

来自「内存管理工具Exmap。该工具比 ps 或 top 更精确」· C语言 代码 · 共 17 行

C
17
字号
/* (c) John Berthels 2005 <jjberthels@gmail.com>. See COPYING for license */#include <stdlib.h>#include <unistd.h>int main(void){     const int malloc_size = 100 * 4096;     const int chunk_size = 2048; /* large allocs don't come from sbrk() */     int total_size;     for (total_size = 0; total_size < malloc_size; total_size += chunk_size) {	  malloc(chunk_size);     }     sleep(60);     return 0;}

⌨️ 快捷键说明

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