Memory allocation problem

BCS ao at pathlink.com
Mon Aug 10 13:42:59 PDT 2009


Reply to Steven,

> On Sun, 09 Aug 2009 15:51:46 -0400, bearophile
> <bearophileHUGS at lycos.com>  wrote:
> 
>> grauzone:
>> 
>>> Then what is there to complain?<
>>> 
>> I have paid for 2 GB RAM, so I am allowed to desire a 1800 MB array
>> :-)
>> 
> hehe.  Not necessarily.
> 
> There are often hardware/OS limitations.  For example, many 32-bit
> Intel  chipsets support 4GB of memory but only allow you to use 3GB
> because 1GB  of *address space* is used for PCI registers.  What ends
> up happening is  you waste 1GB of memory.  However, it's advantageous
> to use 4GB instead of  3GB because of the memory parity -- each
> channel should have the same  amount of memory.  I worked for a
> company that built such systems for some  customers.  It was a pain
> because we wanted to ensure all the memory was  tested, but there was
> no way to physically test it...
> 
> In other cases, there may be video hardware that shares memory with
> your  OS, leaving you less available space.
> 
> My point is, don't count on having 2GB of usable space even if you
> physically have 2GB of RAM, it may not be the case.  Better off to not
> desire than to complain about edge conditions based on hardware
> limitations.  It's like complaining that your car doesn't work
> properly at  150Mph even though the spedometer goes that high.
> 
> -Steve
> 

With virtual memory, the amount of actual RAM you have is only a speed consideration. 
You can allocate 1.5GB of ram on a system with only 512 MB. It just ends 
up swapping when you go and use it. The only constraint is the address space 
and the OS. And with things like me memory mapped files you can even treat 
the CPU address space as a window on the hard drive and allocate more RAM 
than you have address space for.

This blog post and it's link are an interesting read on this topic: http://blogs.msdn.com/oldnewthing/archive/2009/07/06/9818299.aspx





More information about the Digitalmars-d mailing list