3 ms·
Just because a structure is deeply nested doesn’t mean that it consumes a lot of memory. And just because your payload is massive and consumes a lot of memory
by Spivak 7y ago
Just because a structure is deeply nested doesn’t mean that it consumes a lot of memory.
And just because your payload is massive and consumes a lot of memory doesn’t mean it’s deeply nested.
I doubt any of the parsers are resilient against storing large documents in memory. What makes them bad is that structures that would easily fit in memory are unparsable.
In most cases your web server imposed a limit on the size of the HTTP payload so you wouldn’t normally be able to deliver a 128GiB JSON file anyway. It’s not like nested structures are zip-bombs.
- stickfigure 7y agoMy comment was mostly tongue-in-cheek but there's some truth to it. Since the receiver creates a navigable data structure with 64-bit pointers, every two bytes sent ("[]") becomes 20+ bytes in RAM (low estimate!). An order of magnitude magnification helps.