sewardj | 35c1c7c | 2006-08-16 15:07:48 +0000 | [diff] [blame] | 1 | |
| 2 | #include <stdlib.h> |
sewardj | 42e9bd0 | 2006-08-25 13:07:30 +0000 | [diff] [blame] | 3 | #include <stdio.h> |
| 4 | |
sewardj | 35c1c7c | 2006-08-16 15:07:48 +0000 | [diff] [blame] | 5 | char * touch_malloc (int size) |
| 6 | { |
| 7 | char * result; |
| 8 | int i; |
| 9 | result = malloc (size); |
| 10 | for (i = 0; i < size; i++) |
| 11 | *(result + i) = 'a'; |
| 12 | |
| 13 | return result; |
| 14 | } |
| 15 | char * touch_realloc (char * ptr, int size) |
| 16 | { |
| 17 | char * result; |
| 18 | int i; |
| 19 | result = realloc (ptr, size); |
| 20 | for (i = 0; i < size; i++) |
| 21 | *(result + i) = 'a'; |
| 22 | |
| 23 | return result; |
| 24 | } |
| 25 | |
| 26 | int main ( void ) |
| 27 | { |
bart | f976f6c | 2011-04-03 17:42:19 +0000 | [diff] [blame] | 28 | char *a1, *b1, *a2 __attribute__((unused)), *b2 __attribute__((unused)); |
sewardj | 35c1c7c | 2006-08-16 15:07:48 +0000 | [diff] [blame] | 29 | printf("started\n"); |
| 30 | a1 = touch_malloc(1600000) ; |
| 31 | b1 = touch_malloc(200000) ; |
| 32 | a2 = touch_realloc(a1, 1601600) ; |
| 33 | b2 = touch_realloc(b1, 200000) ; |
| 34 | printf("success\n"); |
| 35 | return 0; |
| 36 | }; |