Aviad Rozenhek
Aviad Rozenhek

Reputation: 2409

on windows 7 64bit, how much address space can a 32bit program access?

when using the LARGEADDRESSAWARE flag, can my 32bit program access 4GB of address space, or only 3GB of address space? why?

Upvotes: 0

Views: 2224

Answers (4)

Andrew
Andrew

Reputation: 2568

In most OSes your 32-bit space is broken up into parts that you're program(user-code) can allocate and use, and sections that the kernel owns. Unless you're writing your own OS/kernel let the system APIs(such as malloc/free, new/delete in C/C++) or the the underlying management in python, java manage the memory allocation for you.

However, if you're getting 'out of memory' errors start to consider

  1. Do I have a leak somewhere? You're not free'ing every pointer you're malloc'ing Wonderous tools such as valgrind can help find those.
  2. Do I need to redesign my program to use less memory? Are you doing things like saving every line of data you read out of a huge file in an array in python or java. Look for stuff you can throw away

Upvotes: 0

David Heffernan
David Heffernan

Reputation: 612993

A 32 bit process with LARGEADDRESSAWARE set can address 4GB on 64 bit Windows. It can do so because that's how the wonderful engineers at Microsoft implemented it.

It's documented here.

Upvotes: 3

Cédric Julien
Cédric Julien

Reputation: 80761

maybe the anwser is there

A 32 bit process will access 2GB RAM, with the LARGEADDRESSAWARE flag, it reaches the 4GB

Upvotes: 2

Related Questions