Re: memory allocation

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Sep 25, 2012 at 12:49 PM, Marcelo Bianchi
<mbianchi@xxxxxxxxxxxxxx> wrote:
> Dear list,
>
> I developed a script that have to create considerable array of integer
> numbers in memory. Currently my script has to accommodate in memory two
> arrays of around 120.000 numbers (for one year of data, I would like to
> reach a 2 years per query) that are loaded from a mysql server.
>
> I developed the script on a ubuntu 32bit machine and when I bring this
> script to our server, a 64bit opensuse the normal 128M of memory limit from
> php was exhausted.
>
> On my ubuntu system the script was consuming around 30Mb of memory / year,
> on the opensuse to run the same script it consumes more than 90Mb / year of
> memory.
>
> Is there a way to reduce this memory consumption on a 64bits machine ?
>
> Also, I made a test with four different virtual box machines (two opensuse
> and two ubuntu machines with the same PHP version, opensuse 11.4 and ubuntu
> 11.04 all running php-5.3.5) and it was quite choking the result for me. I
> am still wandering what is the difference between those and how to explain
> the results.
>
> A print screen of my machine running the four virtual boxes can be seen at:
>
> https://sites.google.com/site/foo4funreborn/phpcomp
>
> I would greatly thanks any help,
> with my best regards,
>
> Marcelo Bianchi

Hi,

If you suspect it's because of 64bits, you can always install 32bit
PHP next to the 64bit version. At some point Ubuntu should support
this out of the box with apt-get, but it seems that it's broken,
atleast for now. Other than that, there's probably little you can do,
as PHP will use 64bit integers and 64bit pointers internally, and
there's pretty much nothing you can do about that.

What I would suggest is just change the memory limit of PHP, you can
do that with ini_set inside the PHP script. I assume you have plenty
of ram in the system? If not, you should probably just go back to
32bit OS.

- Matijn

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux