Skip to content

Instantly share code, notes, and snippets.

@d6rkaiz d6rkaiz/mem.c
Created Jan 17, 2011

What would you like to do?
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
int main(int argc, char** argv) {
int max = -1;
int mb = 0;
char* buffer;
if(argc > 1)
max = atoi(argv[1]);
while((buffer=malloc(1024*1024)) != NULL && mb != max) {
memset(buffer, 0, 1024*1024);
printf("Allocated %d MB\n", mb);
printf("Memory Allocate Error\n");
return 0;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.