delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/2002/02/11/15:44:05

X-Authentication-Warning: delorie.com: mailnull set sender to djgpp-workers-bounces using -f
Date: Mon, 11 Feb 2002 15:44:03 -0500
Message-Id: <200202112044.g1BKi3h17738@envy.delorie.com>
From: DJ Delorie <dj AT delorie DOT com>
To: djgpp-workers AT delorie DOT com
In-reply-to: <10202112024.AA29687@clio.rice.edu> (sandmann@clio.rice.edu)
Subject: Re: Alignment problem
References: <10202112024 DOT AA29687 AT clio DOT rice DOT edu>
Reply-To: djgpp-workers AT delorie DOT com
Errors-To: nobody AT delorie DOT com
X-Mailing-List: djgpp-workers AT delorie DOT com
X-Unsubscribes-To: listserv AT delorie DOT com

> We could add a sbrk(0) call before calling sbrk() with the expected 
> size - and if it's aligned the sbrk() value should be also.  If
> sbrk(0) not aligned, we sbrk() the small number of bytes to align - 
> which will always work (unless there's a equality bug right at the
> boundary in sbrk...)

That won't work if the remaining space in the current memory region is
smaller than the malloc() request size.  sbrk(0) will point to the
tail of the current region, but sbrk(N) will return the beginning of a
new region.

> By the way, I think the reason we are off by 4 is stubinfo is 0x54 
> bytes and it's the very first thing we sbrk() :-P

Well, that's easily fixed!

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019