Created
April 22, 2014 09:16
-
-
Save delcypher/11171403 to your computer and use it in GitHub Desktop.
Testing if mallinfo.uordblks includes mmaped memory
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <malloc.h> | |
int main(int argc, char** argv) | |
{ | |
struct mallinfo mi; | |
mi = mallinfo(); | |
printf("BEFORE:\nuordblks:%d\nhblkhd:%d\n\n", mi.uordblks, mi.hblkhd); | |
malloc_stats(); | |
printf("\n\nDOING malloc\n\n"); | |
char* a = malloc( 256 << 20 ); // Ask for 256MB | |
mi = mallinfo(); | |
printf("AFTER:\nuordblks:%d\nhblkhd:%d\n\n", mi.uordblks, mi.hblkhd); | |
malloc_stats(); | |
a[0] = 'a'; | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment