Re[7]: [Gc] Patch for MAX_HEAP_SECTS value

Ivan Maidanski ivmai at
Sat Sep 19 11:51:29 PDT 2009


"Boehm, Hans" <hans.boehm at> wrote:
> -
> > From:  Ivan Maidanski
> > 
> > > > PS. Another Q: Why do we add 1 (to bytes) for VirtualAlloc() in 
> > > > GC_win32_get_mem?
> > > It keeps the heap sections discontiguous, which prevents 
> > blocks from spanning regions which, based on the comment 
> > could result in bad VirtualProtect calls in some 
> > configurations.  It may be that this is unnecessary without 
> > MPROTECT_VDB.  I'm not sure.
> > 
> > In retrospection, "+1" (and the accompanying comment) was 
> > added in gc6.1 when a lot of other MPROTECT-related code has 
> > been changed. "+1" is not needed for GWW or for unmapping 
> > (since VirtualQuery() is used there).
> > 
> It sounds very plausible to me that we could change this if MPROTECT_VDB is not defined.  And it would reduce fragmentation, which may be more of an issue than the occasional untouched page.  But it would require testing to check that we're not overlooking something.

Since we use "+1" only for Win32, the scope (of overlook) is only Win32-specific code...

Back to the subject: it stays a bit unclear to me (from your previous post) whether you think my patch for GET_MME_SCRATCH ( is completely wrong for Win32 (for WinCE I understood your thoughts). If yes then what's possible workaround for the problem? (increase MAX_HEAP_SECTS?)


More information about the Gc mailing list