protocolbuffers / protobuf

Protocol Buffers - Google's data interchange format
http://protobuf.dev
Other
65.25k stars 15.45k forks source link

Memory Leak in PHP version #3181

Closed adhesiveNOR closed 6 years ago

adhesiveNOR commented 7 years ago

I'm trying to parse binary protobuffer file with the size of 7.32MB with protobuf PHP. I'm using version 3.3.0.

PHP Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 7685493 bytes) in D:\swgohreader\php\vendor\google\protobuf\php\src\Google\Protobuf\Internal\Message.php on line 276

I tried to increase memory limit to 256MB also, just to see, but it didn't not help at all. I think there might be a memory leak issue in the PHP version.

TeBoring commented 7 years ago

Could you show me your test code, proto definition and script to reproduce the bug?

adhesiveNOR commented 7 years ago

Hi.. uploaded proto file, script and binary data to gist

adhesiveNOR commented 7 years ago

As a supplement to my issue.. I see the FileDescriptorProto object generated is over 50.000 lines and about 62MB in size if I save it out to file when I get the memory allocate error. I know there is a lot of message definitions in my proto file, but Python is handling it pretty good.. Would it make any difference to split it up into multiple proto files and import them or does the FileDescriptorProto object still get created with all proto definitions (even the ones imported)?

TeBoring commented 7 years ago

Sorry for late reply. Could you try master to see whether the problem still exists?

adhesiveNOR commented 7 years ago

Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 120 bytes) in D:\swgoh-php\src\Google\Protobuf\Internal\Message.php on line 344

Yes, still same issue.

TeBoring commented 6 years ago

Sorry for the late reply. Is the problem still there? Could you paste the context to reproduce the bug here?