From: jlrubin AT NO_MEAT_BYPRODUCTS DOT bway DOT net (Josh Rubin) Newsgroups: comp.os.msdos.djgpp Subject: Why is malloc allocating every other page? Date: Tue, 07 Oct 1997 06:56:05 GMT Message-ID: <3439dc3c.165049@news2.bway.net> NNTP-Posting-Host: 205.198.117.34 Lines: 36 To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Precedence: bulk The test program below allocates blocks of 4000 bytes, which should fit easily in a page even with the malloc overhead. --> malloc allocates *every other* page! <-- (the same thing happens with smaller blocks, like 3000 bytes) -------------- #include #include int main() { int n; void *p; for (n=0;n<10;++n) { p = malloc(4000); /* should fit in 1 page, even with overhead */ printf(" %x\n",(int)p); } return 0; } -------------- 52000 59000 5b000 5d000 5f000 61000 63000 65000 67000 69000 Strip the all-caps text from my address before replying by email. Josh Rubin