Вселенная Кудзу

«Программирование - искусство, воюющее со своими творцами»

Kudzu World  »  Blogspace  »  Kudzu's Tech Blog
English - Română - Русский - عربي

RSS Feed

If you want to more easily stay informed of updates etc you can subscribe to the RSS feed. Just point your RSS reader at this page, auto discovery is enabled.




Using PayPal?
Read this


Windows x64 - It can see more memory, but does it consume more memory?

7/31/2008

Everyone knows x64 allows you to use memory beyond the 4 GB limit. However does x64 use more memory than 32 bits for running the same programs? I've provided the answer to that and some other details here.

64 bits = x64, but 32 bits = x86

It seems odd, but because of history 32 bits is referred to as x86 (as in 8086 through 80486), and 64 bits is referred to as x64. Sometimes x32 is also used, but x86 is more common and I will use that notation here.

While x86 and x64 can be applied to many operating systems, for the purposes of this article x86 means Windows 32 bit, and x64 means Windows 64 bit.

x64 can see more memory

If you have more than 3 GB RAM you should consider using x64. Contrary to popular x86 cannot use 4 GB of RAM. The amount varies depending on your computer configuration, but for most computers x86 can only use between 3.2 and 3.5 GB of RAM. For details on why, please see Windows - When 4 = 3.

Using x64 when you have 3 GB or less I think provides no advantage, except in the following cases:

In other cases I expect that x64 will use slightly more memory than x86 for the same processes.

Testing Methodology

My evaluation was done using Windows Server 2008 x86 and x64 in VMWare. I expect nearly identical results would be seen if comparing x86 and x64 versions of Vista or XP. I am certainly interested in updating this blog with additional information or corrections if necessary.

I performed a default install of Standard Edition in two new virtual machines. I made no changes and performed no clean up of the hard disks afterward, thus the following numbers include the swap file initialized by Windows. The memory size was set to 512 MB, the minimum required by Windows 2008. No windows updates or other software was installed. VMWare tools was not installed.

Expected Results

In the past it was common for processors to align opcode sizes to the data size. So the move from 8 to 16 and to 32 bit often saw great leaps in actual memory usage. But as I understand it, on Intel processors x64 actually uses the same op codes and thus sizes as x86. Intel opcodes are variable length, but the important factor is that x64 does not mean the minimum opcode size has been increased to 64 bits. What x64 means actually is that there are more 64 bit math operations available, 64 bit registers are available, and memory is available in a 64 bit address space. So the move to x64 should increase actual memory usage somewhat to account for larger pointers. But exactly how much?

Install Sizes

While not part of the final result I have included some other measurements here that may be useful. For some reason x64 bit installation media is significantly larger than x86. I've seen this with all versions of Windows and some applications as well. I am not sure why this is.

Size of ISO installation media:

x64 contains Hyper-V which is not available in x86. Other features including certain security aspects are also x64 only. The biggest reason that the x64 ISO is larger though is because many system components need to be installed in both x86 and x64 versions to allow x86 programs to run on x64.

Install Footprints

x64 includes Hyper-V, although it is not enabled by default. The larger installation footprint is because of the same reason the ISO is larger, primarily because many components must exist in both x86 and x64 forms.

Amount of used space on C: drive immediately after installation:

Memory Usage

Finally we arrive at the answer to my initial curiosity. Does x64 use more memory (as opposed to just being able to use more memory) that x86? Is my hypothesis correct? The answer is yes!

Immediately after installation I started task manager and then let it run for an extended period to make sure each system was settled down. I even took the measurements before checking for disk space so as to avoid launching any new processes.

Difference: 77 MB

Take a look at the Kernel memory usage:

Difference: 56 MB

Not all applications are 64 bit. x64 runs nearly all x86 applications just fine, inside of a 32 bit space. So if you look at the fact that the kernel uses more memory and that it certainly is 64 bit, then account for drivers and some 64 bit applications, it appears that x64 code does consume quite a bit more memory because of:

  1. Loading of both x86 and x64 bit sub systems
  2. Usage of 64 bit pointers increases binary foot print of executable code slightly.

It appears that x64 applications on average will use about 25% more memory than their x86 counterparts. I think in fact this is very reasonable, especially considering in the past such changes historically often nearly doubled the amount of ram usage.

Go x64?

The memory requirements should not discourage you from using x64. However if you are running Windows in a virtual machine, or you never plan to go beyond 3 GB of RAM, running x86 can certainly save you some memory.

If you are running many virtual machine guests in parallel as I do, this can certainly make quite a difference. It is rare that any of my virtual machines will ever need more than 3 GB of memory so I will certainly continue to use x86 there. I also have a mini-server that only has 512 MB of RAM. It only does some simple tasks, but I will certainly keep it x86 to give it more breathing room in memory.

But for all other tasks, it is clear, x64 is the way to go!

Task Manager Screenshots

The screenshots of task manager are below. x64 has 31 processes running, while x86 has 32. I am not sure what accounts for the difference, but I don't suspect it accounts for the memory difference, especially since x64 has one less application, but more memory usage.


x86


x64

<< Previous Entry  Next Entry >>

Comments: 


Add your comment: 

Name:    
E-Mail:  
URL:  
Comment:  
Please add 5 and 2 and type the answer here:



Use my contact form to contact me directly.