manual-core.xml: Fix various xmllint issues.
[valgrind.git] / massif / tests / pages_as_heap.c
blobc36650f5d043704f8db0983c8afc43fe34c4a769
1 #include <stdio.h>
2 #include <unistd.h>
4 #define MAX 20000
6 int main () {
7 int i;
8 int inc_dec;
9 int delta;
10 intptr_t brk_stat;
12 // loop to first increase, then decrease
13 for (inc_dec = 1; inc_dec >= -1; inc_dec-=2) {
14 // loop to increase(decrease) with small then big delta
15 for (delta = 1; delta <= 400; delta+=399) {
16 if (0) printf("initial brk value for inc_dec %d delta %d: %p\n",
17 inc_dec, delta, sbrk(0));
18 for (i=0; i<MAX; i++) {
19 brk_stat = (intptr_t)brk(sbrk(0) + inc_dec * delta);
20 if (brk_stat == -1) {
21 printf("brk value at failure: %p\n", sbrk(0));
22 perror ("brk() failed!\n");
23 return 0;
26 if (0) printf("resulting brk value for inc_dec %d delta %d: %p\n",
27 inc_dec, delta, sbrk(0));
31 return 0;