Created
January 21, 2018 06:50
-
-
Save kaityo256/40790bc3ce51b2235e3ae9ca3d99eeef to your computer and use it in GitHub Desktop.
Test for mmapped arena
This file contains hidden or 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 <cstdio> | |
| #include <cstdlib> | |
| #include <omp.h> | |
| const int N = 128; | |
| int | |
| main(void){ | |
| char *buf[N]; | |
| #pragma omp parallel for | |
| for(int i=0;i<N;i++){ | |
| buf[i] = (char*)malloc(128); | |
| } | |
| for(int i=0;i<N;i++){ | |
| size_t *p = (size_t*)buf[i]; | |
| if (*(p-1) & 4){ | |
| printf("mmapped arena is used.\n"); | |
| goto label; | |
| } | |
| } | |
| label: | |
| for(int i=0;i<N;i++){ | |
| free(buf[i]); | |
| buf[i][0] = 0; | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment