[CentOS] 32bit vs 64bit memory usage

George Negoita

negoita.george at gmail.com
Thu May 21 20:30:44 UTC 2009


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?

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.

-- 
George Negoita
System Administrator
iMedia Plus Group



More information about the CentOS mailing list