Re: heap

Tech-Archive recommends: Speed Up your PC by fixing your registry



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
.



Relevant Pages

  • Re: heap
    ... other additional allocated private heaps) allocated by a process can not ... includes chunks carved out for the exe, any/all DLLs, stack, etc. DLLs ... Studio, when your app is running under the debugger, open up the ... Under a 64-bit OS, you could easily allocate four 512-MB chunks, ...
    (microsoft.public.vc.language)
  • Re: private Deploy of SQL CE 3.1
    ... my app is always a newer one than whatever is in ROM, ... device uses 3.1 dlls. ... All was fine as long as my desktop app was ... I also found that in Platform builder when I removed "sql mobile" ...
    (microsoft.public.sqlserver.ce)
  • Re: private Deploy of SQL CE 3.1
    ... my app is always a newer one than whatever is in ROM, ... device uses 3.1 dlls. ... All was fine as long as my desktop app was ... I also found that in Platform builder when I removed "sql mobile" ...
    (microsoft.public.sqlserver.ce)
  • Re: private Deploy of SQL CE 3.1
    ... my app is always a newer one than whatever is in ROM, ... device uses 3.1 dlls. ... All was fine as long as my desktop app was ... I privately deploy my SqlCe DLLs with my apps, ...
    (microsoft.public.sqlserver.ce)
  • Re: private Deploy of SQL CE 3.1
    ... Windows XP and Windows CE give same Sort Key ... my app is always a newer one than whatever is in ROM, ... device uses 3.1 dlls. ... I also found that in Platform builder when I removed "sql mobile" ...
    (microsoft.public.sqlserver.ce)