Skip to content

Instantly share code, notes, and snippets.

@tokuhirom
Created October 8, 2008 04:33
Show Gist options
  • Save tokuhirom/15446 to your computer and use it in GitHub Desktop.
Save tokuhirom/15446 to your computer and use it in GitHub Desktop.
#include <stdlib.h>
#include <stdio.h>
int main (int argc, char**argv) {
// ./a.out malloc 10000 100000
int count = atoi(argv[2]);
int size = atoi(argv[3]);
printf("count: %d, size: %d\n", count,size);
if (argv[1][0] == 'm') {
for (int i=0; i<count; i++) {
malloc(size * sizeof(int));
}
} else {
for (int i=0; i<count; i++) {
calloc(size, sizeof(int));
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment