I know this is Off-topic but I also know there are a lot of smart people 
"lurking" on this list.

I have a PHP-script that does not run from a web-server but directly in a 
shell. When I run it I get the following error:

# ./dj.php
PHP Fatal error:  Allowed memory size of 100663296 bytes exhausted (tried to 
allocate 104 bytes) in /usr/local/scripts/includes/dj.inc on line 79
Allowed memory size of 100663296 bytes exhausted (tried to allocate 24 bytes)

My scripts starts with:
#!/usr/bin/php
<?php

ini_set('memory_limit', '4192M');

include "dj.inc";

And in php.ini I have:
memory_limit = 1G      ; Maximum amount of memory a script may consume

Why does PHP not honor my memory limits?
I have set 1GB in php.ini and 4192MB (I know that is more then 1GB) and the 
scripts fails at 100663296 bytes (~ 96MB). I have also tried with other memory 
settings but I always end up with with the failure at ~96MB. The host has 
enough RAM (32GB) to support the script.

Any suggestions on how to solve the issue (short of rewriting the script in C 
or C++)?

Regards,
-- 
Dan Johansson, <http://www.dmj.nu>
***************************************************
This message is printed on 100% recycled electrons!
***************************************************

Reply via email to