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

Error with analyze dump memory #49

Closed
Shkarbatov opened this issue Nov 21, 2017 · 5 comments
Closed

Error with analyze dump memory #49

Shkarbatov opened this issue Nov 21, 2017 · 5 comments
Assignees
Labels

Comments

@Shkarbatov
Copy link

Shkarbatov commented Nov 21, 2017

Hi! Trying to make memory dump:

gc_collect_cycles();
meminfo_dump(fopen('/home/dmitriy/phpmem/my_dump_file.json', 'w'));`

Then run analyzer and receive an error:

$ analyzer/bin/analyzer summary my_dump_file.json

[Symfony\Component\Serializer\Exception\UnexpectedValueException]  
Control character error, possibly incorrectly encoded    
$ ls -al
-rw-rw-r--  1 dmitriy dmitriy 8093889 Ноя 21 15:30 my_dump_file.json

In memory dump I have next item:

    "0x7f31bcb13620" : {
        "type" : "array",
        "size" : "72",
        "is_root" : false
,
        "children" : {
            "1|	":"0x7f31be24dca0"
        }

    }

Why dump create this "1| ":"0x7f31be24dca0" ?
This is not valid json.


Second question:

$ analyzer/bin/analyzer ref-path 0x7f254b257c20 my_dump_file100.json 

Found 2 paths
Path from 0x7f255ce562c0
0x7f254b257c20
      ^       
      |       
_entityManager
      |       
      |       
0x7f254b2d1d40
      ^       
      |       
runningCommand
      |       
      |       
0x7f255ce562c0

Path from 0x7f255ce562e0
0x7f254b257c20
      ^       
      |       
_entityManager
      |       
      |       
0x7f254b2d1d40
      ^       
      |       
runningCommand
      |       
      |       
0x7f255ce562c0
      ^       
      |       
 application  
      |       
      |       
0x7f255ce562e0

It is not, what I see here: https://github.com/BitOne/php-meminfo/blob/master/doc/hunting_down_memory_leaks.md#4-finding-references-to-the-leaked-object

How to understand with this output like you write in your example:

So the reason why our object is still in memory is because it's in an array, that is itself in another array that is in an final array. And the final array is directly linked to the variable declared in the frame and called myRootArray.

I think you need to add parameter -v in example:

$ bin/analyzer ref-path 0x7f94a1877068 /tmp/php_mem_dump.json

@BitOne
Copy link
Owner

BitOne commented Nov 24, 2017

Hello @Shkarbatov , I have been able to reproduce the problem.

"children" : {
            "1| ":"0x7f31be24dca0"
        }

may be invalid if the character after the | is a control character. It translates into a space in the issue, but it's certainly the reason (the pipe | is totally allowed as character though).

I have a test use case reproducing the issue and I will work on fixing it.

Thanks !

@BitOne BitOne added the bug label Nov 24, 2017
@BitOne BitOne self-assigned this Nov 24, 2017
@Shkarbatov
Copy link
Author

Yes, problem in controle character - it is tab character.

@BitOne BitOne closed this as completed in 652434d Nov 24, 2017
BitOne added a commit that referenced this issue Nov 24, 2017
@BitOne
Copy link
Owner

BitOne commented Nov 24, 2017

Hey @Shkarbatov ,

I've committed a fix and released a 1.0.1 version.

If that's possible for you, can you check it again ?

Thank you!

@Shkarbatov
Copy link
Author

Check it - fixed.
Thanks!

@BitOne
Copy link
Owner

BitOne commented Dec 8, 2017

Thanks @Shkarbatov for your answer!

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

No branches or pull requests

2 participants