Our website uses cookies to enhance your browsing experience.
Accept
to the top
close form

Fill out the form in 2 simple steps below:

Your contact information:

Step 1
Congratulations! This is your promo code!

Desired license type:

Step 2
Team license
Enterprise license
** By clicking this button you agree to our Privacy Policy statement
close form
Request our prices
New License
License Renewal
--Select currency--
USD
EUR
* By clicking this button you agree to our Privacy Policy statement

close form
Free PVS‑Studio license for Microsoft MVP specialists
* By clicking this button you agree to our Privacy Policy statement

close form
To get the licence for your open-source project, please fill out this form
* By clicking this button you agree to our Privacy Policy statement

close form
I am interested to try it on the platforms:
* By clicking this button you agree to our Privacy Policy statement

close form
check circle
Message submitted.

Your message has been sent. We will email you at


If you do not see the email in your inbox, please check if it is filtered to one of the following folders:

  • Promotion
  • Updates
  • Spam

Webinar: Evaluation - 05.12

>
>
How much memory can an application acce…

How much memory can an application access in Win32 and Win64?

Jan 23 2012
Author:

When developing a software product for a Windows-family operating system, you must keep in mind the restrictions imposed on sizes of data a program can declare and use.

Windows imposes the following 3 types of restrictions on applications:

  • Static data. The restriction is imposed on the size of the program source code itself and the size of statically allocated memory. In C++, such data is usually represented by global variables defined by outside procedures. The restriction concerning the size of statically allocated memory is 2 Gbytes both for 32-bit and 64-bit programs.
  • Dynamic data. This is data for which memory is being allocated while executing the program. In C++, this allocation is usually performed by the malloc function or new operator. In 32-bit programs the size of dynamically allocated memory is restricted to 2 Gbytes, in 64-bit programs to 8 Tbytes.
  • Stack data. Memory is allocated for this data when entering a procedure, and is released after exiting the procedure. The maximum size of program stack is 1 Gbyte for both 32-bit and 64-bit applications. (The stack size is defined by the linker and is 1 Mbyte by default)

For a 32-bit application launched in a 32-bit Windows, the total size of all the mentioned data types must not exceed 2 Gbytes. (Actually it is 1.75 Gbytes due to memory requirements of the operating system itself). A 32-bit program compiled with the switch /LARGEADDRESSAWARE:YES can allocate up to 3 Gbytes of memory if the 32-bit Windows is launched with the /3gb switch. The same 32-bit program launched in a 64-bit system can allocate about 4 Gbytes (actually about 3.5 Gbytes).

Note that the restrictions for maximum sizes of statically allocated memory and stack memory are the same for 32-bit and 64-bit Windows-applications. This is determined by the format of file type Portable Executable (PE), which is used in Windows to describe exe and dll files. You should keep in mind that these restrictions are imposed by the operating system itself, and do not depend on the compiler you are using.

References

Popular related articles


Comments (0)

Next comments next comments
close comment form