delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/2001/07/04/02:30:02

Date: Wed, 4 Jul 2001 09:30:56 +0300 (IDT)
From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
X-Sender: eliz AT is
To: Matthew Conte <matt AT conte DOT com>
cc: djgpp-workers AT delorie DOT com
Subject: Re: malloc() problem, DJDEV 203
In-Reply-To: <002901c10421$1423b1c0$e33e1d18@nycap.rr.com>
Message-ID: <Pine.SUN.3.91.1010704093030.3231A-100000@is>
MIME-Version: 1.0
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

On Tue, 3 Jul 2001, Matthew Conte wrote:

> > If that doesn't work, I think we can safely decline anything above 2GB,
> > which will avoid the signed/unsigned nuisance (inside malloc as well).
> 
> careful:  sbrk() will accept negative values.

Of course, it can: that's how you release memory to the system.  (Our
`sbrk' doesn't release memory, but it does support negative
arguments.)

But I don't understand the ``careful'' part: the fact that unsigned
values larger than 2GB can be interpreted as negative is _precisely_
the reason I suggested to stop at 2GB (Charles points out that 2GB
minus 64KB is a better value).  This number cannot be interpreted as a
negative one, so where's the problem?

Note that I was talking about arguments to `malloc', not to `sbrk',
and `malloc' doesn't allow negative arguments.  Did you perhaps think
that I was suggesting that `sbrk' fails for > 2GB?  If so, this is not
a problem with `malloc'.

- Raw text -


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