davidh@syma.sussex.ac.uk (David Hobley) (02/07/91)
I am just finishing a port of a system developed here called poplog. I have got a working binary except that it keeps running out of memory. I have an earlier version of poplog which worked under A/UX 1.1, but after the upgrade to 2.0, it stopped working with the same symptom as displayed here. What the problem seems to be is that the brk system call gives up way before all the memory is actually used up. This can be duplicated easily with a C program. Provided the break is continuously increased there is no problem. When the break is decreased and then pushed up again, eventually the call fails. I proved this by hacking the source so that it would never decrease the size. The system then worked as expected. Here is the C program: #include <stdio.h> #define DELTA 0x1000 main() { int i, d = DELTA, peaked = 0; printf("START: "); i = sbrk(0); printf(" %x\n", i); for(;;) { i += d; if (brk(i)) break; if (i > 0x500000) { d = -DELTA; printf("MAX: %x\n", i); peaked = 1; } else if (i < 0x430000) { d = DELTA; if (peaked) printf("MIN: %x\n", i); } } printf("FAILED: %x\n", i); } This seems to be a big problem - anyone any patches, workarounds? By the way, this works on Suns, HP's, DEC's ..... Cheers, davidh