halaxa / json-machine

Efficient, easy-to-use, and fast PHP JSON stream parser

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Allowed memory size exhausted

vinikey opened this issue · comments

Hello halaxa!

First of all, thank you for your work!
I would need, if it's possible a bit of help or more examples how to use this lib.
I have a json file (19,1MB) and I'm trying to read it using

foreach (\JsonMachine\JsonMachine::fromFile(BASE_PATH . '/sm/seasons.json') as $key => $value) { var_dump([$key, $value]); }

but my host returns the msg

PHP Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 20480 bytes) in /***/htdocs/vendor/halaxa/json-machine/src/Parser.php on line 177

Probably there is something that I don't understand right and I cannot use in the right way the library.
Any help will be appreciated!

Thank you!

I just saw this
I'm going to play a bit with the Pointer to check if I can get the data from the file.
Is there any limit why I cannot get the json from "/"?

Thank you!!!

Hi, "/" is gotcha example, see https://github.com/halaxa/json-machine#json-pointer. Paste here an excerpt of the json structure you're trying to parse. I'll be glad to help.