[xdebug-dev] Bug 0000226: Xdebug2 doesn't show memory (or memory delta)

From: <noreply[@]lists.xdebug.org>
Date: Wed, 20 Dec 2006 13:07:06 +0100

A BUGNOTE has been added to this bug.
======================================================================
http://bugs.xdebug.org/bug_view_page.php?bug_id=0000226
======================================================================
Reporter: jeroen
Handler:
======================================================================
Project: Xdebug
Bug ID: 226
Category: Usage problems
Reproducibility: always
Severity: major
Priority: normal
Status: feedback
Operating System: Windows XP
PHP Version: 5.2.0
Xdebug Version: 2.0.0rc1
======================================================================
Date Submitted: 2006-12-11 11:57 CET
Last Modified: 2006-12-20 13:07 CET
======================================================================
Summary: Xdebug2 doesn't show memory (or memory delta)
Description:
Description:
------------
Xdebug doesn't show correct memory in trace file (maybe this has something
to do with the new memory management of PHP 5.2.0?)

Reproduce code:
---------------
I'm running PHP from command line

php -e -c "PHP_PATH/php.ini" -d error_reporting="E_ALL | E_STRICT" -d
zend_extension_ts="PATH/TO/php_xdebug-2.0.0rc1-5.2.0.dll" -d
xdebug.auto_trace=1 -d xdebug.trace_output_dir="SOME_PATH\tmp\trace" -d
xdebug.show_mem_delta=1 -d xdebug.trace_format=0 some_script.php

Expected result:
----------------
I expected to see a different number where it says "0" (memory usage) and
"+0" (memory delta). These numbers are the same troughout the script. It's
not very likely a script doesn't use any memory ;-)

Actual result:
--------------
These are the first 10 lines from the trace file:

TRACE START [2006-12-11 10:41:26]
    0.0008 0 +0 -> {main}()
D:\server\www\sobe-1.2\Test\AdvProfiler\xdebug\script\ProfileTest.php:0
    0.0010 0 +0 -> test_function()
D:\server\www\sobe-1.2\Test\AdvProfiler\xdebug\script\ProfileTest.php:25
    0.0011 0 +0 -> trim()
D:\server\www\sobe-1.2\Test\AdvProfiler\xdebug\script\ProfileTest.php:8
    0.0012 0 +0 -> round()
D:\server\www\sobe-1.2\Test\AdvProfiler\xdebug\script\ProfileTest.php:8
    0.0013 0 +0 -> TestClass->__construct()
D:\server\www\sobe-1.2\Test\AdvProfiler\xdebug\script\ProfileTest.php:26
    0.0016 0 +0 -> TestClass->DoSomething()
D:\server\www\sobe-1.2\Test\AdvProfiler\xdebug\script\ProfileTest.php:27
    0.0016 0 +0 -> rand()
D:\server\www\sobe-1.2\Test\AdvProfiler\xdebug\script\ProfileTest.php:19
    0.0017 0 +0 -> array_flip()
D:\server\www\sobe-1.2\Test\AdvProfiler\xdebug\script\ProfileTest.php:20
    0.0018 0 +0 -> test_function()
D:\server\www\sobe-1.2\Test\AdvProfiler\xdebug\script\ProfileTest.php:25
    0.0018 0 +0 -> trim()
D:\server\www\sobe-1.2\Test\AdvProfiler\xdebug\script\ProfileTest.php:8

======================================================================

----------------------------------------------------------------------
 jeroen - 2006-12-11 12:09 CET
----------------------------------------------------------------------
Some additional phpinfo information (sorry I forgot to add it to the
orginal report):

phpinfo()
PHP Version => 5.2.0

System => Windows NT RAHRAH 5.1 build 2600
Build Date => Nov 2 2006 11:50:55
Configure Command => cscript /nologo configure.js
"--enable-snapshot-build" "--with-gd=shared"
Server API => Command Line Interface
Virtual Directory Support => enabled
Configuration File (php.ini) Path => D:\server\php\php-5.2.0\php.ini
PHP API => 20041225
PHP Extension => 20060613
Zend Extension => 220060519
Debug Build => no
Thread Safety => enabled
Zend Memory Manager => enabled
IPv6 Support => enabled
Registered PHP Streams => php, file, data, http, ftp, compress.zlib,
https, ftps
Registered Stream Socket Transports => tcp, udp, ssl, sslv3, sslv2, tls
Registered Stream Filters => convert.iconv.*, string.rot13,
string.toupper, string.tolower, string.strip_tags, convert.*, consumed,
zlib.*

This program makes use of the Zend Scripting Language Engine:
Zend Engine v2.2.0, Copyright (c) 1998-2006 Zend Technologies
    with Xdebug v2.0.0RC1, Copyright (c) 2002, 2003, 2004, 2005, 2006, by
Derick Rethans

 _______________________________________________________________________

xdebug

xdebug support => enabled
Version => 2.0.0RC1

Supported protocols => Revision
DBGp - Common DeBuGger Protocol => $Revision: 1.99 $
GDB - GNU Debugger protocol => $Revision: 1.81 $
PHP3 - PHP 3 Debugger protocol => $Revision: 1.20 $

Directive => Local Value => Master Value
xdebug.allowed_clients => no value => no value
xdebug.auto_trace => On => On
xdebug.collect_includes => On => On
xdebug.collect_params => Off => Off
xdebug.collect_return => Off => Off
xdebug.collect_vars => Off => Off
xdebug.default_enable => On => On
xdebug.dump.COOKIE => no value => no value
xdebug.dump.ENV => no value => no value
xdebug.dump.FILES => no value => no value
xdebug.dump.GET => no value => no value
xdebug.dump.POST => no value => no value
xdebug.dump.REQUEST => no value => no value
xdebug.dump.SERVER => no value => no value
xdebug.dump.SESSION => no value => no value
xdebug.dump_globals => On => On
xdebug.dump_once => On => On
xdebug.dump_undefined => Off => Off
xdebug.extended_info => On => On
xdebug.idekey => Jeroen => no value
xdebug.manual_url => http://www.php.net => http://www.php.net
xdebug.max_nesting_level => 100 => 100
xdebug.profiler_aggregate => Off => Off
xdebug.profiler_append => Off => Off
xdebug.profiler_enable => Off => Off
xdebug.profiler_enable_trigger => Off => Off
xdebug.profiler_output_dir => /tmp => /tmp
xdebug.profiler_output_name => crc32 => crc32
xdebug.remote_autostart => Off => Off
xdebug.remote_enable => Off => Off
xdebug.remote_handler => dbgp => dbgp
xdebug.remote_host => localhost => localhost
xdebug.remote_log => no value => no value
xdebug.remote_mode => req => req
xdebug.remote_port => 9000 => 9000
xdebug.show_exception_trace => Off => Off
xdebug.show_local_vars => Off => Off
xdebug.show_mem_delta => On => On
xdebug.trace_format => 0 => 0
xdebug.trace_options => 0 => 0
xdebug.trace_output_dir =>
D:\server\www\sobe-1.2\Test\AdvProfiler\xdebug\\tmp\trace =>
D:\server\www\sobe-1.2\Test\AdvProfiler\xdebug\\tmp\trace
xdebug.trace_output_name => crc32 => crc32
xdebug.var_display_max_data => 512 => 512
xdebug.var_display_max_depth => 2 => 2

----------------------------------------------------------------------
 jeroen - 2006-12-11 12:16 CET
----------------------------------------------------------------------
Also, I experienced the same problem with APD for PHP 5.2.0
(http://nl3.php.net/apd)

I don't know about previous versions of PHP, I haven't tried them as I
don't have the binaries of those versions.

----------------------------------------------------------------------
 derick - 2006-12-11 21:56 CET
----------------------------------------------------------------------
Please try the latest version from
http://pecl4win.php.net/ext.php/php_xdebug.dll, this should be fixed.

----------------------------------------------------------------------
 jeroen - 2006-12-11 22:13 CET
----------------------------------------------------------------------
I tried the last version from PECL4WIN for PHP 5.2, and memory usage still
isn't shown:

TRACE START [2006-12-11 21:10:41]
    0.0004 0 +0 -> {main}()
D:\server\www\sobe-1.2\Test\AdvProfiler\xdebug\script\ProfileTest.php:0
    0.0005 0 +0 -> test_function()
D:\server\www\sobe-1.2\Test\AdvProfiler\xdebug\script\ProfileTest.php:25
    0.0006 0 +0 -> trim()
D:\server\www\sobe-1.2\Test\AdvProfiler\xdebug\script\ProfileTest.php:8
    0.0006 0 +0 -> round()
D:\server\www\sobe-1.2\Test\AdvProfiler\xdebug\script\ProfileTest.php:8
    0.0007 0 +0 -> TestClass->__construct()
D:\server\www\sobe-1.2\Test\AdvProfiler\xdebug\script\ProfileTest.php:26
    0.0009 0 +0 -> TestClass->DoSomething()
D:\server\www\sobe-1.2\Test\AdvProfiler\xdebug\script\ProfileTest.php:27
    0.0010 0 +0 -> rand()
D:\server\www\sobe-1.2\Test\AdvProfiler\xdebug\script\ProfileTest.php:19
    0.0010 0 +0 -> array_flip()
D:\server\www\sobe-1.2\Test\AdvProfiler\xdebug\script\ProfileTest.php:20
    0.0011 0 +0 -> test_function()
D:\server\www\sobe-1.2\Test\AdvProfiler\xdebug\script\ProfileTest.php:25
    0.0011 0 +0 -> trim()
D:\server\www\sobe-1.2\Test\AdvProfiler\xdebug\script\ProfileTest.php:8
    0.0011 0 +0 -> round()
D:\server\www\sobe-1.2\Test\AdvProfiler\xdebug\script\ProfileTest.php:8
    0.0011 0 +0 -> TestClass->__construct()
D:\server\www\sobe-1.2\Test\AdvProfiler\xdebug\script\ProfileTest.php:26

I have tried compiling php 5.2 with --enable-memory-limit (still on
windows), but that doesn't seem to make any difference, no memory usage
there either.

----------------------------------------------------------------------
 jeroen - 2006-12-11 22:30 CET
----------------------------------------------------------------------
Also, the timestamp on the top of the trace file is set to one hour earlier
than my system time for some reason. (This is a new output file, I deleted
the old ones before testing the latest PECL4WIN release).

----------------------------------------------------------------------
 jeroen - 2006-12-11 22:32 CET
----------------------------------------------------------------------
My timezone settings in php.ini are correct btw:

[Date]
; Defines the default timezone used by the date functions
date.timezone = Europe/Amsterdam

----------------------------------------------------------------------
 derick - 2006-12-11 22:39 CET
----------------------------------------------------------------------
The date/time is expected, the log files always show GMT/UTC. I'll need
some more time to check out the memory stuff. I will do that when I get
access to a windows machine again.

----------------------------------------------------------------------
 jeroen - 2006-12-11 22:43 CET
----------------------------------------------------------------------
Ok, looking forward to the results.
If you need some feedback/debug reports from a Windows machine, just ask
me and I'll see what I can do.

----------------------------------------------------------------------
 jeroen - 2006-12-12 02:44 CET
----------------------------------------------------------------------
I tested with PHP 5.0.5 and the same problem exists:

cmd: php -e -d
zend_extension_ts=D:\server\php\php-5.0.5\ext\php_xdebug.dll -d
xdebug.auto_trace=1 -d xdebug.trace_output_dir="/tmp/trace" -d
xdebug.show_mem_delta=1 -d xdebug.trace_format=0 -r "$tmp = ''; function
editme() {global $tmp; $tmp.= 'hoi'; } for($i = 0; $i < 1024; $i++) {
editme(); }"

output:
TRACE START [2006-12-12 01:41:46]
    0.0005 0 +0 -> {main}() Command line code:0
    0.0008 0 +0 -> editme() Command line code:1
    0.0010 0 +0 -> editme() Command line code:1
    0.0011 0 +0 -> editme() Command line code:1
    0.0012 0 +0 -> editme() Command line code:1
    0.0015 0 +0 -> editme() Command line code:1
    0.0016 0 +0 -> editme() Command line code:1
    0.0017 0 +0 -> editme() Command line code:1
    0.0018 0 +0 -> editme() Command line code:1
    0.0021 0 +0 -> editme() Command line code:1
    0.0022 0 +0 -> editme() Command line code:1
etc...

----------------------------------------------------------------------
 derick - 2006-12-12 13:47 CET
----------------------------------------------------------------------
On a stock PHP 5.0.5 it is expected as well, as memory limit is not enabled
by default there either.

----------------------------------------------------------------------
 jeroen - 2006-12-12 16:49 CET
----------------------------------------------------------------------
For what it's worth, I made a feature change request at php.net ;-)

----------------------------------------------------------------------
 derick - 2006-12-20 13:07 CET
----------------------------------------------------------------------
Your feature request has been implemented in PHP Cvs now, so please get the
latest Xdebug from pecl4win.php.net (dated after now). Please let me know
whether it works as I still don't have access to Windows.

Bug History
Date Modified Username Field Change
======================================================================
2006-12-11 11:57jeroen New Bug
2006-12-11 11:57jeroen Bug Monitored: jeroen
2006-12-11 12:09jeroen Bugnote Added: 0000502
2006-12-11 12:16jeroen Bugnote Added: 0000503
2006-12-11 21:56derick Bugnote Added: 0000504
2006-12-11 21:56derick Status new => feedback
2006-12-11 22:13jeroen Bugnote Added: 0000505
2006-12-11 22:30jeroen Bugnote Added: 0000506
2006-12-11 22:32jeroen Bugnote Added: 0000507
2006-12-11 22:39derick Bugnote Added: 0000509
2006-12-11 22:43jeroen Bugnote Added: 0000510
2006-12-12 02:44jeroen Bugnote Added: 0000511
2006-12-12 13:47derick Bugnote Added: 0000515
2006-12-12 16:49jeroen Bugnote Added: 0000518
2006-12-20 13:07derick Bugnote Added: 0000525
======================================================================
Received on Wed Dec 20 2006 - 13:07:15 GMT

This archive was generated by hypermail 2.2.0 : Sun Jun 24 2018 - 04:00:03 BST