This is the mail archive of the
cygwin-patches@cygwin.com
mailing list for the Cygwin project.
Re: init_cheap and _csbrk
- From: Christopher Faylor <cgf at redhat dot com>
- To: cygwin-patches at cygwin dot com
- Date: Tue, 6 Aug 2002 18:07:31 -0400
- Subject: Re: init_cheap and _csbrk
- References: <01e501c23d74$400b2c90$6132bc3e@BABEL>
- Reply-to: cygwin-patches at cygwin dot com
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 "cygheap.cc", 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
>alright).
>
>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.
Thanks,
cgf