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

From: <noreply[@]lists.xdebug.org>
Date: Mon, 25 Dec 2006 16:19:51 +0100

The following bug has been CLOSED
======================================================================
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: closed
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-25 16:19 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.

----------------------------------------------------------------------
 jeroen - 2006-12-20 13:10 CET
----------------------------------------------------------------------
Cool, I'll have a look at it and will let you know some time later today.

----------------------------------------------------------------------
 jeroen - 2006-12-20 14:22 CET
----------------------------------------------------------------------
Looks like pecl4win hasn't compiled for a few days (16 December for the
last time), I'm waiting for the next build.

----------------------------------------------------------------------
 jeroen - 2006-12-21 16:18 CET
----------------------------------------------------------------------
I can tell you that this works (it didn't before, it would exit because of
the fatal error saying call to undeclared function):

D:\server\php\php5.2-win32-200612201130>php -r "echo memory_get_usage();"
50832

(this is a snapshot from yesterday)

So far, so good. Still waiting on the next pecl4win build :-)

----------------------------------------------------------------------
 jeroen - 2006-12-21 16:40 CET
----------------------------------------------------------------------
Any idea when these builds occur?

----------------------------------------------------------------------
 derick - 2006-12-24 20:43 CET
----------------------------------------------------------------------
I managed to build it myself, but unfortunately the memory stuff still
doesn't show up because the MEMORY_LIMIT define is not set in the windows
build.

----------------------------------------------------------------------
 derick - 2006-12-24 21:03 CET
----------------------------------------------------------------------
Ah, that was my mistake. The module at
http://xdebug.org/link.php?url=xdebug200rc2-521-win should work for you
(as long as you have the latest PHP snapshot)

----------------------------------------------------------------------
 jeroen - 2006-12-25 14:57 CET
----------------------------------------------------------------------
WOOHOO!!!

I just downloaded the latest snap and your .dll and it WORKS!!

Thanks, man!

Btw, if you need some more Windows testing, feel free to contact me.

______________________________________________________

cmd: php -e -d
zend_extension_ts=D:\server\php\php5.2-win32-200612251130\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-25 13:49:39]
    0.0396 54264 +54264 -> {main}() Command line code:0
    0.0849 54536 +272 -> editme() Command line code:1
    0.0968 54712 +176 -> editme() Command line code:1
    0.0969 54712 +0 -> editme() Command line code:1
    0.0969 54744 +32 -> editme() Command line code:1
    0.0970 54744 +0 -> editme() Command line code:1
    0.0971 54744 +0 -> editme() Command line code:1
    0.0971 54784 +40 -> editme() Command line code:1
    0.0972 54784 +0 -> editme() Command line code:1
    0.0974 54792 +8 -> editme() Command line code:1
    0.0974 54792 +0 -> editme() Command line code:1
    0.0975 54792 +0 -> editme() Command line code:1
    0.0975 54800 +8 -> editme() Command line code:1

----------------------------------------------------------------------
 derick - 2006-12-25 16:19 CET
----------------------------------------------------------------------
Cool, let's close the report then :-)

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
2006-12-20 13:10jeroen Bugnote Added: 0000526
2006-12-20 14:22jeroen Bugnote Added: 0000527
2006-12-21 16:18jeroen Bugnote Added: 0000528
2006-12-21 16:40jeroen Bugnote Added: 0000529
2006-12-24 20:43derick Bugnote Added: 0000530
2006-12-24 21:03derick Bugnote Added: 0000531
2006-12-25 14:57jeroen Bugnote Added: 0000532
2006-12-25 16:19derick Bugnote Added: 0000533
2006-12-25 16:19derick Status feedback => closed
======================================================================
Received on Mon Dec 25 2006 - 16:19:52 GMT

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