Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Registered callables like autoloader or error handler not taken into account #78

Open
BitOne opened this issue Aug 13, 2018 · 1 comment

Comments

@BitOne
Copy link
Owner

BitOne commented Aug 13, 2018

These callables could be Closure, hence objects that take some space in memory.

@mathieuk
Copy link
Contributor

mathieuk commented Oct 23, 2018

The prototype I mention in #83 (comment) will detect closures that would be provided to set_error_handler(). It won't detect regular callables ( like 'myfunc' or [$this, 'myfunc'] ).

<?php

$b = 123;
set_error_handler(function () use ($b) { });

meminfo_dump(fopen('dump2.json', 'w+'));

would result in the following output/dump:

$ php -dextension=meminfo.so test3.php
Found unseen alive object: Closure #1 (0x7f0abea66640)
$ cat dump2.json
{
  "header" : {
    "memory_usage" : 391112,
    "memory_usage_real" : 2097152,
    "peak_memory_usage" : 427008,
    "peak_memory_usage_real" : 2097152
  },
  "items": {

...

    "0x7f0abea66640":	{
        "class" : "Closure",
        "is_root" : false,
        "frame" : "<OBJECTS_IN_OBJECT_STORE>",
        "object_handle" : "1",
        "type" : "object",
        "size" : "56"

    }
  }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants