Skip to content

Instantly share code, notes, and snippets.

@reagent
Created March 25, 2013 19:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save reagent/5240086 to your computer and use it in GitHub Desktop.
Save reagent/5240086 to your computer and use it in GitHub Desktop.
Checking size of allocation
#include <stdlib.h>
#include <stdio.h>
#include <malloc/malloc.h>
int
main()
{
char *thing = malloc(1 * sizeof(char));
printf("Alloc'd: %ld bytes\n", malloc_size(thing));
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment