delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2002/02/08/17:00:06

X-Authentication-Warning: delorie.com: mailnull set sender to djgpp-bounces using -f
From: "Charles Sandmann" <sandmann AT clio DOT rice DOT edu>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Alignment problem
Date: Fri, 8 Feb 2002 15:43:27
Organization: Aspen Technology, Inc.
Lines: 20
Message-ID: <3c63f21f.sandmann@clio.rice.edu>
References: <0BA32251E589D2118EA60008C70DDCAB025F91A5 AT JNJFRISEXS1 DOT eu DOT jnj DOT com> <3C63F73A DOT 3FEF6F56 AT cyberoptics DOT com>
NNTP-Posting-Host: dcloan.hou.aspentech.com
X-Trace: selma.aspentech.com 1013204947 30288 10.32.115.107 (8 Feb 2002 21:49:07 GMT)
X-Complaints-To: postmaster AT aspentech DOT com
NNTP-Posting-Date: 8 Feb 2002 21:49:07 GMT
X-NewsEditor: ED-1.5.8
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

> A note to those attempting to reproduce these problems:  the alignments
> seem to be random, so that a single trial of the program is
> insufficient.  After several runs, I was about to conclude that the
> pointers *were* properly aligned under Win95, until I closed the DOS
> box, ran and closed a Windows program, opened a new DOS box, and ran my
> program again.  Then the pointers were only 4-byte aligned.

I suspect the alignment changes depending on the sbrk() return value to
the first time malloc() builds it's memory.

sbrk() can also return non-contiguous blocks at times which malloc() may
not handle well.  (This can be based on what Win95 would return, so it
can make the behavior unpredictable itself).

I agree that malloc() should do a better job for best performance.  If
someone posts a fix to malloc it will get into a new version faster -
else it will be fixed when someone has the time and motivation to 
look at it.

Thanks for reporting this.

- Raw text -


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