Signed-off-by: Wenchao Hao <haowenchao22@gmail.com>
This commit is contained in:
Wenchao Hao 2024-09-27 17:34:03 +08:00
commit 88490b1846
3 changed files with 28 additions and 0 deletions

BIN
.nfs00000000003c000200000001 Executable file

Binary file not shown.

BIN
.nfs00000000003c000400000003 Executable file

Binary file not shown.

28
demo.c Normal file
View File

@ -0,0 +1,28 @@
#include <stdio.h>
#include <stdlib.h>
#define MB_BYTES (1024*1024)
int main(void)
{
unsigned long *p;
int i = 0;
int nr_mb;
int bytes;
int max;
printf("please specify how many memory to alloc\n");
scanf("%d", &nr_mb);
bytes = nr_mb * MB_BYTES;
max = bytes / 8;
p = malloc(bytes);
for (i = 0; i < max; i++)
*(p + i) = i;
while(1);
return 0;
}