init_cheap and _csbrk

Christopher Faylor
Tue Aug 6 15:07:00 GMT 2002

On Tue, Aug 06, 2002 at 07:08:21PM +0100, Conrad Scott wrote:
>I stumbled over this last night but I thought it better to wait
>until I'd had both sleep and pizza before posting it off :-)
>The _csbrk function, from "", is rounding up the first
>allocation to a multiple of a page size, which seems unnecessary
>since VirtualAlloc does that anyway (i.e., if you reserve/commit a
>single byte on a page, it reserves/commits the whole page).  More
>importantly, it can't be right to add the allocation request size
>to the return value for the first allocation (except that the
>first "allocation" is probably always 0, so actually it's
>And while I was there I moved one initialization about for the
>usual "aesthetic" reasons :-)

I've checked in a modified version of this.  I actually wanted to
allocate some slop for the cygheap but the pagetrunc made sure that
I actually didn't do that.  So, I've changed things so that an extra
couple of pages are allocated.  It would be nice to find out what the
minimal amount of memory used during a small program would be and
just allocate that at the start to minimize calls to VirtualAlloc.

Also my aesthetic sense differs from yours so I didn't apply that part.


More information about the Cygwin-patches mailing list