Skip to content

Instantly share code, notes, and snippets.

@metalefty
Created August 16, 2012 15:21
Show Gist options
  • Save metalefty/3370976 to your computer and use it in GitHub Desktop.
Save metalefty/3370976 to your computer and use it in GitHub Desktop.
メモリお掃除的な何か。メモリ掃除の類の操作に意味があるかは否定的な立場だけど、とりあえず作ってみた。
#include <stdio.h>
#define SIZE sizeof(int) * 1024 * 1024 * 1024 / 2 - 1
/* Usage: $ dd if=/dev/zero bs=1m count=768 | ./a.out */
int main(void)
{
char *c = malloc(SIZE);
fgets(c, SIZE, stdin);
free(c);
}
@alf-ytakada
Copy link

callocでどうかな

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment