From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (qmail 27444 invoked from network); 29 Jun 1998 20:16:31 -0000 Received: from mail12.digital.com (192.208.46.20) by mail2.redhat.com with SMTP; 29 Jun 1998 20:16:31 -0000 Received: from us1rmc.bb.dec.com (us1rmc.bb.dec.com [16.57.16.6]) by mail12.digital.com (8.8.8/8.8.8/WV1.0f) with SMTP id QAA08274 for ; Mon, 29 Jun 1998 16:16:28 -0400 (EDT) Received: from linux01.hlo.dec.com by us1rmc.bb.dec.com (5.65/rmc-17Jan97) id AA26767; Mon, 29 Jun 98 16:12:18 -0400 Received: (from paradis@localhost) by linux01.hlo.dec.com (8.8.7/8.8.7) id QAA09705 for axp-list@redhat.com; Mon, 29 Jun 1998 16:10:18 -0400 From: Jim Paradis Message-Id: <199806292010.QAA09705@linux01.hlo.dec.com> Subject: Re: malloc oddity? To: axp-list@redhat.com Date: Mon, 29 Jun 1998 16:10:18 -0400 (EDT) In-Reply-To: from "Mike Tripicco" at Jun 29, 98 03:32:56 pm X-Mailer: ELM [version 2.4 PL25] Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit > Anyway, my problem is related to the fact that when I malloc anything more > than 128kb the allocated memory suddenly jumps to a very high address: > > # testalloc 131048 > allocating 131048 bytes > address is 0x150000250 > > # testalloc 131049 > allocating 131049 bytes > address is 0x15555568010 I'm just curious; why is this a problem? Surely you're not assuming that malloc'ed memory is contiguous?! Malloc can return you a pointer anywhere it pleases 8-) Seriously; what you see is normal malloc behavior. The smaller malloc's are being done as an sbrk() off the end of the program's data segment, whereas the larger ones are being done as anonymous mmap's(). In the case of 64-bit Alpha processes, mmap() starts searching for free memory at 0x15555560000 (TASK_SIZE / 3, rounded up to a page boundary). > Running the same test program on an Alpha running OSF/1 v3.2 shows no such > behavior. Is this related to the same bugs in the linker and/or assembler > which cause the infamous "relocation truncated to fit" errors discussed > back in April of 1997? No relation whatsoever, just different mmap behavior. -- Jim Paradis (paradis@linux01.hlo.dec.com) "The early bird gets the worm. Digital Equipment Corporation If you want something else for (508)841-3243 breakfast, get up later." http://www.tiac.net/users/jrp/index.html