Ticket #14332: forktest.cpp
File forktest.cpp, 389 bytes (added by , 6 years ago) |
---|
Line | |
---|---|
1 | #include <stdio.h> |
2 | #include <sys/types.h> |
3 | #include <unistd.h> |
4 | #include <strings.h> |
5 | #include <string.h> |
6 | #include <stdlib.h> |
7 | |
8 | #define SIZ (200 * 1024 * 1024) |
9 | int main() |
10 | { |
11 | char* data = (char*)malloc(SIZ); |
12 | for (int i = 0; i < SIZ; i++) |
13 | data[i] = '\0'; |
14 | printf("forking\n"); |
15 | fork(); |
16 | sleep(5); |
17 | printf("setting\n"); |
18 | for (int i = 0; i < SIZ; i++) |
19 | data[i] = '\0'; |
20 | sleep(5); |
21 | return 0; |
22 | } |