[xdebug-general] Re: stacktrace on memory exhausted

From: Derick Rethans <derick[@]xdebug.org>
Date: Wed, 26 Nov 2008 09:33:12 +0100 (CET)

On Tue, 25 Nov 2008, Jack Bates wrote:

> I am not yet using a remote debugger with Xdebug, but the stacktraces
> Xdebug prints are already a boost to my productivity - thanks!
>
> Today I am trying to get my app to run with 16M of memory or less, so I
> keep seeing:
>
> Fatal error: Allowed memory size of 16777216 bytes exhausted (tried to
> allocate 4864 bytes)
> in /home/jablko/public_html/qubit/lib/model/om/BaseObject.php on line
> 342
>
> How can I use Xdebug to get a stacktrace when the memory exceeds 16M?

If it's enabled and loaded properly, that happens automatically:

derick[@]kossu:~$ php-5.2dev -dmemory_limit=16M -r 'function a() { $a = ""; while( true ) { $a .= "fff"; } } function b() { a(); } b();';

Fatal error: Allowed memory size of 16777216 bytes exhausted at
/home/derick/dev/php/php-5.2dev/Zend/zend_operators.c:1200 (tried to
allocate 16514893 bytes) in Command line code on line 1

Call Stack:
    0.0002 117072 1. {main}() Command line code:0
    0.0002 117384 2. b() Command line code:1
    0.0002 117696 3. a() Command line code:1

regards,
Derick

-- 
Like Xdebug? Send a postcard: http://derickrethans.nl/xdebug_2_released.php
Xdebug | http://xdebug.org | xdebug-general@lists.xdebug.org
Received on Wed Nov 26 2008 - 09:33:13 GMT

This archive was generated by hypermail 2.2.0 : Mon Jun 25 2018 - 06:00:04 BST