== Quote from Rainer Schuetze (r.sagita...@gmx.de)'s article
> Vladimir Panteleev wrote:
> > On Thu, 15 Jul 2010 11:03:57 +0300, JimBob <j...@bob.com> wrote:
> >
> >> VirtualAlloc returns chunks that have 'dwAllocationGranularity'
> >> granularity,
> >> which is 64K on every Windows OS I've used. So allocating a page, 4K,
> >> will
> >> actualy get you 64K.
> >>
> >> So using VirtualAlloc as a replacement for malloc is very wasteful unless
> >> the allocations are larger that 64K.
> >>
> >> You might want to look at HeapCreate and it's siblings. (on windows
> >> anyway)
> >
> > dwAllocationGranularity only controls the granularity of the allocation
> > address, but not of the allocation size. A simple program that calls
> > VirtualAlloc 16384 times uses up 1 GB of the address space, but only 64
> > MB of actual memory. So, while it is a waste of address space, it's not
> > a waste of system memory.
> In a 32-bit process, the waste of address space is sometimes more
> critical nowadays. There is only 2GB virtual memory available (3GB with
> some tweaks), and with the example above, VirtualAlloc fails well before
> allocating 128 MB.

Yea, but I wonder how much longer it is going to be before 32-bit is dead as a
dodo except on things like netbooks.  Frankly, it's about time for it to die,
because dealing w/ address space limitations when plenty of physical memory is
available just plain sucks.  DMD is in the process of being ported to 64-bit as 
we
speak.  Almost any Linux distro is available in 64-bit.  IIRC (I can't remember
for sure where I heard this) Windows 7 will be the last 32-bit version, and it
seems like most people who have migrated use the 64-bit version.

On the hardware end, 64-bit is now 6-7 years old, which has to be a standard
deviation or two older than the average age at which computers get replaced.

Reply via email to