This is the mail archive of the
cygwin-patches@cygwin.com
mailing list for the Cygwin project.
Re: init_cheap and _csbrk
"Christopher Faylor" <cgf@redhat.com> wrote:
> On Tue, Aug 06, 2002 at 07:08:21PM +0100, Conrad Scott wrote:
> 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.
I wasn't thinking of efficiency while I was looking at this. I
was actually trying to understand an apparent memory leak on fork.
(I found that BTW: it's the "well-known" one in the per_thread
mechanism. So I've stopped worrying about it.)
But: the slop will never get used AFAICT (so it's not really
slop). That is, this padding just pushes the cygheap_max pointer
further up; all subsequent calls to _csbrk will allocate past that
point, and so the slop will remain unused. So if you want the
slop to be allocated in future, you'll need to drag cygheap_max
back down to (char *) (cygheap + 1) + sbs --- ooh! that looks
familiar --- after the recursive call. Unless I'm missing the
obvious of course.
> Also my aesthetic sense differs from yours so I didn't apply
that part.
That's the beauty of aesthetics :-)
Thanks,
// Conrad