delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/2002/05/17/13:26:09

From: sandmann AT clio DOT rice DOT edu (Charles Sandmann)
Message-Id: <10205171727.AA21975@clio.rice.edu>
Subject: Re: emacs under w2k and malloc effects
To: djgpp-workers AT delorie DOT com
Date: Fri, 17 May 2002 12:27:24 -0500 (CDT)
In-Reply-To: <3CE517CD.AD3D0617@yahoo.com> from "CBFalconer" at May 17, 2002 10:46:37 AM
X-Mailer: ELM [version 2.5 PL2]
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

> However if something else effectively calls sbrk with a negative
> value, nmalloc may later think it has a new noncontiguous block,
> and may then very well allocate the same space twice!.  This would
> NOT be good.

If someone calls sbrk() with a negative value, they are deallocating
memory.  This isn't any different than doing
 for(i=4096;i<bigvalue;i++)
   free(i);
Yes, you can do stupid things to kill your program.  

feeding sbrk() negative values has valid uses, but it's a rare thing
that would only be used carefully.

> It cannot be protected by insisting on monatonic increasing, since
> I found that the startup code does some wierd things and leaves
> things fragmented before the application starts.

DPMI may also return memory blocks without being monatonic increasing.

- Raw text -


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