Still getting memory errors
Closed this issue · 5 comments
Can you provide better examples on how to use this? PHP still returns memory issues:
Allowed memory size of 134217728 bytes exhausted
The examples are lacking. All it shows is a way to read the entire file into memory, which is what I thought this code is supposed to be avoiding.
Don't use getJson()
. The point of the parser is that you implement a Listener
that responds to events as the system reads through the data. getJson()
returns the whole document and is only there for debugging.
The issue occurs before getJson is called. I had already updated the comment. Saying "responds to events" still isn't an example. Can you show an example?
@t7m One of possible usage of this library is in JsonCollectionParser project. Look here for sources: https://github.com/MAXakaWIZARD/JsonCollectionParser/tree/master/src
So there are no actual examples in this project. Wasted time. Thanks, I'm done here.
@t7m You're right we're lacking many detailed examples. It does follow the SAX-like parsing pattern, so if you google that you'll get the idea pretty quickly. Or if you paste in your Listener implementation here someone might be able to help.
Common issue with out of memory is that you're holding onto all the data from the JSON in variables such as an array, possibly accidentally.