Best way to increase memory limit

108 views
Skip to first unread message

Álvaro G. Vicario

unread,
Dec 7, 2011, 5:40:42 AM12/7/11
to doc...@googlegroups.com
I've installed DocBlox 0.16 through the PEAR installer. I'm trying out the software in a middle-sized PHP project of my own, but it seems it needs more memory than the 128MB of my default PHP setup. What's the recommended and less messy way to increase the memory_limit directive only for DocBlox?

I've replaced bare "docblox" call with this:

    php -d memory_limit=256MB "%PHP_PEAR_BIN_DIR%\docblox.php" ...

... will all the possible syntax variations I could think of but I just get this:

    Fatal error: Allowed memory size of 262144 bytes exhausted (tried to allocate 261904 bytes) in Unknown on line 0
    Could not startup.

The -d parameter is being used because I no longer have a 128MB limit when I add it, but my value for it is definitively ignored.

(BTW, the  Google Groups link to DocBlox bug tracker is broken.)

Álvaro G. Vicario

unread,
Dec 14, 2011, 4:45:59 AM12/14/11
to doc...@googlegroups.com
For the records: in the end, I edited the original script.

#!C:\Archivos de programa\PHP\php.exe
<?php

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

?>
<?php
/**
* DocBlox
*
* @category DocBlox
I'll just do it again on every upgrade, it's not a great deal.

Ce Be

unread,
Dec 14, 2011, 10:16:12 AM12/14/11
to doc...@googlegroups.com
What about setting it in php.ini?

memory_limit = 256M


2011/12/14 Álvaro G. Vicario <alv...@demogracia.com>

Mike van Riel

unread,
Dec 14, 2011, 11:15:54 AM12/14/11
to doc...@googlegroups.com
If I look at the output in your original mail then it seems you have a
rather large source file in your project (more than 20.000 to 50.000
lines of code).

The following feedback shows that 256MB is not enough for that
particular file (as it uses 255MB).

>> Allowed memory size of 262144 bytes exhausted (tried to allocate
261904 bytes

Try setting your memory limit to 300MB.

Unfortunately this is caused by the token_get_all function of php and is
something which I cannot resolve.

Álvaro G. Vicario

unread,
Dec 14, 2011, 11:55:58 AM12/14/11
to doc...@googlegroups.com
Well... That doesn't increase the memory_limit directive only for DocBlox (if you use the main php.ini file) and it isn't the less messy way (if you have to maintain a separate copy of php.ini).
Reply all
Reply to author
Forward
0 new messages