I have just noticed a very large difference in memory usage for the PHP applications that I have developed for my company between my developmental machine and the "production " machine:
Development PC: PHP version 4.3.9 on a 32 bit using Linux Centos 4.5 as operating system.
Production machine: PHP version 5.1.2 on a 64 bit machine with Linux Novell Suse 10.1 as operating system.
I noticed this because I started to get memory limit exceeded errors on some page requests for one of the applications. Out of curiosity I inserted this line at several locations in the scripts to get an idea of the difference in memory usage between the two machines:
The table below shows an example output. The first column is from the 32 bit machine, the second is from the 64 bit machine, and the 3rd column is the difference. Each row represents a later location in the scripts.
This large difference between the two machines really surprises me. Does anyone know what the primary cause may be? Is it because of the 32bit vs. 64bit architecture? Or is it because of the PHP4 vs. PHP5 versions?
[P:S: It may seem strange that I am developing applications with PHP4 that are intended to be deployed with PHP5. For the curious, here are the reasons: 1) the production server is new and I have not had a chance to upgrade the development machine, 2) so far it seems to work and 3) the new management at this small startup company has decided to outsource all IT related needs and purchase commercial software and my position has actually been terminated (I am currently looking for new work), hence there is no incentive to upgrade the development machine :) ]
Development PC: PHP version 4.3.9 on a 32 bit using Linux Centos 4.5 as operating system.
Production machine: PHP version 5.1.2 on a 64 bit machine with Linux Novell Suse 10.1 as operating system.
I noticed this because I started to get memory limit exceeded errors on some page requests for one of the applications. Out of curiosity I inserted this line at several locations in the scripts to get an idea of the difference in memory usage between the two machines:
Code:
echo "memory = " . memory_get_usage(true) . "<br>";
Code:
PHP4 PHP 5 difference 3179336 2018056 1161280 4347824 2729504 1618320 5870144 3665760 2204384 5921784 3698664 2223120 6442704 4033856 2408848 8374136 5034368 3339768
[P:S: It may seem strange that I am developing applications with PHP4 that are intended to be deployed with PHP5. For the curious, here are the reasons: 1) the production server is new and I have not had a chance to upgrade the development machine, 2) so far it seems to work and 3) the new management at this small startup company has decided to outsource all IT related needs and purchase commercial software and my position has actually been terminated (I am currently looking for new work), hence there is no incentive to upgrade the development machine :) ]
Comment