[CentOS] 32bit vs 64bit memory usage

Robert Heller heller at deepsoft.com
Thu May 21 20:59:22 UTC 2009


At Thu, 21 May 2009 23:30:44 +0300 CentOS mailing list <centos at centos.org> wrote:

> 
> Hi!
> 
> I ran the following test on 3 different setups:
> 
> #!/usr/bin/php
> <?
>     $n=1024*256;
> 
>     $usage1=memory_get_usage();
>     $rusage1=memory_get_usage(true);
>     $a=array();
>     for($i=0;$i<$n;$i++)
>       $a[]=0;
>     $usage2=memory_get_usage();
>     $rusage2=memory_get_usage(true);
>     echo ($usage2-$usage1).'/'.($rusage2-$rusage1);
> ?>
> 
> ...and I got the following results:
> 
> 32bit kernel & 32bit php - 18875368/19136512
> 64bit kernel & 64bit php - 35654376/35913728
> 64bit kernel & 32bit php - 18875368/19136512
> 
> Some client has a 64bit xen-based VPS with 512MB RAM user for
> webhosting and I'm wondering if I can free some memory installing
> httpd&php i386 modules.
> 
> I understand that 64bit programs use more memory because the pointers,
> integers, etc. are now 64bit instead of 32bit, but running a 32bit
> program on a 64bit architecture is the same as running that program on
> a 32bit architecture (just concerning the memory used)? At least,
> that's my conclusion after running the above test. Am I wrong?

No, you are not wrong. All x86 flavered 64-bit processors will run as
32-bit (i686) processors and when running in 32-bit mode are
effectively just a i686 as far as any 32-bit program can tell.  There
is no reason NOT to just install a straight 32-bit OS on such a machine
if there is less than 4gig of virtual memory and non-of the programms
being run has any reason to use the 64-bit address space.  Web hosting
is a good example of this. 

> 
> Thank you!
> 
> PS: No, the client's service provider does not offer a 32bit vps
> platform and the client won't change the provider or pay for
> additional memory.
> 

-- 
Robert Heller             -- 978-544-6933
Deepwoods Software        -- Download the Model Railroad System
http://www.deepsoft.com/  -- Binaries for Linux and MS-Windows
heller at deepsoft.com       -- http://www.deepsoft.com/ModelRailroadSystem/
                                                                                                               



More information about the CentOS mailing list