Re: heap
- From: nathan@xxxxxxxx (Nathan Mates)
- Date: Wed, 14 Nov 2007 18:11:03 -0000
In article <715474BB-01A6-4F29-8770-DBE1112E150B@xxxxxxxxxxxxx>,
=?Utf-8?B?R2Vvcmdl?= <George@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote:
I want to confirm that, for example, if a process creates 4 heaps
and the total size of the 4 heaps can not exceeds 4G (because they
share the same address space)? e.g. the 1st heap is from 3.5G to 4G,
the 2nd heap is from 3G to 3.5G, the 3rd heap is from 2.5G to 3G and
the 4th heap is from 2G to 2.5G?
You really need to read up on memory management on 32-bit Windows
vs 64-bit Windows. On a 32-bit OS (Win2000, XP, Vista-32), apps are
normally limited(* - see next paragraph) to a 2GB address space, which
includes chunks carved out for the exe, any/all DLLs, stack, etc. DLLs
can load themselves at really inconvenient places, splitting your
available address space up by a lot. If you're using MS Developer
Studio, when your app is running under the debugger, open up the
'Modules' debugger pane, then scroll to the right in it so that the
'Address' column is visible. That'll show you were all DLLs that
loaded -- whether you requested them or not -- are eating into your
available space. Things like instant messenger apps, etc can and will
decide to jump into your 2GB space. And you can't control what's
loaded on end user's boxes.
(*) With Windows's boot.ini, and special compile flags, you can
specify that your app gets a third gig of memory. However, it's not
guaranteed to be a nice contiguous 3GB, because a lot of 'system' DLLs
load towards the top of the 2nd gig, instead of the top of the 3rd
gig. See above for how to look at who's where while under the
debugger.
Under a 64-bit OS, you could easily allocate four 512-MB chunks,
and all would 'just work'. If you want to control 4GB, you REALLY
should go this way. If you want to work with a 32-bit OS, then you
have to behave like most other apps do -- allocate chunks at time when
needed. Don't think you can control the address space when running
under 32-bit Windows, because you're playing by someone else's rules.
Go 64-bit, or try another OS.
Nathan Mates
--
<*> Nathan Mates - personal webpage http://www.visi.com/~nathan/
# Programmer at Pandemic Studios -- http://www.pandemicstudios.com/
# NOT speaking for Pandemic Studios. "Care not what the neighbors
# think. What are the facts, and to how many decimal places?" -R.A. Heinlein
.
- Follow-Ups:
- Re: heap
- From: George
- Re: heap
- Prev by Date: Re: Inter-app communication
- Next by Date: Re: Reaping a process without a parent process/service/daemon
- Previous by thread: Re: heap
- Next by thread: Re: heap
- Index(es):
Relevant Pages
|