Mail Archives: djgpp/2002/02/08/17:00:06
> 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 -