From: Orin E. <ori...@gm...> - 2011-04-28 00:44:04
|
On Wed, Apr 27, 2011 at 4:55 PM, Tim Roberts <ti...@pr...> wrote: > Michael Plante wrote: > > Tim Roberts wrote: > >>> Windows does not use the zero-page technique. > > I'm not sure this is true. It might be more accurate to say that the C > > Runtime Library doesn't make any assumptions about the page. > > You are exactly right -- my statement was too broad. The Windows kernel > certainly uses the zero-page copy-on-write concept, but the CRT does not > assume it. > If you choose the debug CRT, it will fill the memory with something other that 0 - 0xCD I believe. > > The whole zero-page thing can only help calloc if the allocation is > large enough to require whole pages. Most libusb allocations are for > structures, which are small. Such allocations will be sharing a page > with other heap residents, so it has to do a memset. > Right, an allocation smaller than a page could contain anything in the non-debug CRT as it could be memory that was previously allocated/freed. Orin. |