Co-Authored-By: Claude Sonnet 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01CifR2BE7PBvRy5hT8TS9oz
1.9 KiB
1.9 KiB
streaming-huge-json
Companion code for the rewritten post Jackson Streaming API and JsonNode (Jackson 3).
A self-contained Maven module (not part of the root build). It generates a 1 GiB JSON array,
then counts the ERROR records four ways under fixed -Xmx limits.
Jackson 3.2.4 (tools.jackson.core:jackson-databind, GA on Maven Central 2026-10-18)
JDK Temurin 25.0.5 (LTS)
| Class | What it shows |
|---|---|
GenerateHugeJson |
Writing 1 GiB with JsonGenerator under -Xmx64m |
Scan |
stream, hybrid, tree, bind (and the broken hybrid-naive) |
NestedTrap |
The flat-object loop breaking on nested JSON; skipChildren() fix |
TruncatedFile |
What a cut-off file does to streaming vs tree |
ReadLimits |
Default StreamReadConstraints values |
cd streaming-huge-json
./scripts/run-all.sh --quick # small demos only
./scripts/run-all.sh # also generates target/huge.json (1 GiB, git-ignored) and runs the ladder
Captured output is in output/. Memory figures are from one run on a 2-CPU, 8 GB
container; peakUsed is sampled total - free heap and includes garbage not yet collected.
Timings vary between runs; the pass/fail pattern per -Xmx is the stable part.
Note on output/bench.txt: the tree -Xmx= 6144 MB KILLED line comes from a separate manual run
(the first ladder run printed a blank line for it because the OS killed the JVM, exit 137);
scripts/bench.sh now records that case itself.