4 ms·
Bad string allocations can easily swamp the JVM, with things like loops adding a single character to a string with a string allocation each loop, and other naiv
by AtlasBarfed 7y ago
Bad string allocations can easily swamp the JVM, with things like loops adding a single character to a string with a string allocation each loop, and other naive approaches turning what should be a small reused buffer into gigabytes of heap.
The JVM does a remarkable job of just-good-enough don't-worry-about-GC, but anyone who is a paid programmer needs to understand rudimentary aspects of GC, or your stuff will go sideways fast in production.
- nottorp 7y ago<quote>Bad string allocations can easily swamp the JVM</quote> Like String.split() and whatever BufferedReader does, I guess. It's not like i was doing byte by byte manipulation. The GC just triggered too often.