View Issue Details

IDProjectCategoryView StatusLast Update
0000226XdebugUsage problems (Wrong Results)public2006-12-25 16:19
ReporterjeroenAssigned To 
PrioritynormalSeveritymajorReproducibilityalways
Status closedResolutionopen 
Product Version 
Target VersionFixed in Version 
Summary0000226: Xdebug2 doesn't show memory (or memory delta)
DescriptionDescription:
------------
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
TagsNo tags attached.
Operating SystemWindows XP
PHP Version5.2.0

Activities

jeroen

2006-12-11 12:09

reporter   ~0000502

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

reporter   ~0000503

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

administrator   ~0000504

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

reporter   ~0000505

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

reporter   ~0000506

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

reporter   ~0000507

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

administrator   ~0000509

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

reporter   ~0000510

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

reporter   ~0000511

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

administrator   ~0000515

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

reporter   ~0000518

For what it's worth, I made a feature change request at php.net ;-)

derick

2006-12-20 13:07

administrator   ~0000525

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

reporter   ~0000526

Cool, I'll have a look at it and will let you know some time later today.

jeroen

2006-12-20 14:22

reporter   ~0000527

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

reporter   ~0000528

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

reporter   ~0000529

Any idea when these builds occur?

derick

2006-12-24 20:43

administrator   ~0000530

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

administrator   ~0000531

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

reporter   ~0000532

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

administrator   ~0000533

Cool, let's close the report then :-)

Issue History

Date Modified Username Field Change
2006-12-11 11:57 jeroen New Issue
2006-12-11 12:09 jeroen Note Added: 0000502
2006-12-11 12:16 jeroen Note Added: 0000503
2006-12-11 21:56 derick Note Added: 0000504
2006-12-11 21:56 derick Status new => feedback
2006-12-11 22:13 jeroen Note Added: 0000505
2006-12-11 22:30 jeroen Note Added: 0000506
2006-12-11 22:32 jeroen Note Added: 0000507
2006-12-11 22:39 derick Note Added: 0000509
2006-12-11 22:43 jeroen Note Added: 0000510
2006-12-12 02:44 jeroen Note Added: 0000511
2006-12-12 13:47 derick Note Added: 0000515
2006-12-12 16:49 jeroen Note Added: 0000518
2006-12-20 13:07 derick Note Added: 0000525
2006-12-20 13:10 jeroen Note Added: 0000526
2006-12-20 14:22 jeroen Note Added: 0000527
2006-12-21 16:18 jeroen Note Added: 0000528
2006-12-21 16:40 jeroen Note Added: 0000529
2006-12-24 20:43 derick Note Added: 0000530
2006-12-24 21:03 derick Note Added: 0000531
2006-12-25 14:57 jeroen Note Added: 0000532
2006-12-25 16:19 derick Status feedback => closed
2006-12-25 16:19 derick Note Added: 0000533
2016-07-31 13:36 derick Category Usage problems => Usage problems (Crashes)
2016-07-31 13:38 derick Category Usage problems (Crashes) => Usage problems (Wrong Results)