php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #45778 Dump list of objects/variables and their memory usage
Submitted: 2008-08-10 12:16 UTC Modified: 2008-08-10 12:58 UTC
Votes:2
Avg. Score:5.0 ± 0.0
Reproduced:2 of 2 (100.0%)
Same Version:1 (50.0%)
Same OS:2 (100.0%)
From: sebastian at sebsoft dot nl Assigned:
Status: Wont fix Package: Feature/Change Request
PHP Version: 6CVS-2008-08-10 (CVS) OS: All
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: sebastian at sebsoft dot nl
New email:
PHP Version: OS:

 

 [2008-08-10 12:16 UTC] sebastian at sebsoft dot nl
Description:
------------
When developing on larger PHP-CLI projects, it seems that sometimes memory usage increases while running; possibly doing nothing more than instantiating objects/variables and replacing them by new objects/variables but not destroying references correctly.

I would like to request a function that is able to give a dump of all client created objects/variables that currently occupy the memory in this instance, and if possible, the memory usage created by those objects/variables.

This will help identifying possible memory issues while developing code.

My suggestion would be to have a php.ini setting that, when enabled, tracks usage, so it would be possible to disable this feature in production environments.

Something similar was already requested in bug #16564, but was closed with a solution which doesn't give as much detail as what I am requesting in this request.

Expected result:
----------------
A possible expected output could be an array containing the objects and the memory usage created by them. This array could be multi dimensional to track where the object/variable in question exists.


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2008-08-10 12:58 UTC] johannes@php.net
That's not possible  with the way PHP manages its memory. You can use XDebug (www.xdebug.org) and some frontend like kcachegrind or wincachegrind to get memory profiling of your application, then you can see where the memory usage increases. Please refer to general PHP or XDebug support facilities (php.net/support.php) for further assistance.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Oct 31 23:01:28 2024 UTC