- Joined
- Oct 19, 2023
allocating 15000 gc objects and then seeing them getting freed in a big chunk is about as slow as malloc()ing those same 15000 objects and manually free()ing them when they fall out of scopeThe java memory management system totally sucks I have no clue why anyone would defend it
Did they accidentally swap from an alternate timeline where enterprise software is actually good or something?
except the gc will actually work better in this scenario because it can do things like defragment the memory
just because the sawtooths are microscopic with malloc() doesn't mean they don't existRe: memory usage sawtooth graphs, what do people imagine a memory usage graph should look like? That's the pattern of dynamic memory usage, a bunch of stuff gets allocated and eventually falls out of scope and are (or should be) cleaned up. But I suppose it's just the magical thinking of retards imagining that somehow freeing memory costs nothing when a human does it and everything when a runtime does.
People loved to blame the performance on Java and GC back in the day, but as far as I know the actual issue was the renderer, which used the ancient OpenGL 1 and did ridiculous shit like issuing a draw call for every block or so. Once the overhaul of the renderer landed (around 1.8?), performance got noticeably better. I'm not sure how you'd run specifically into GC issues in Minecraft either to be honest, outside of Java pointer soup being taxing in general.
as always the real problem is the code that allocates 9 octillion vector3 on the heapTrue, but then Mojang started using immutable data-object classes for their basic Vector3f, BlockPos, Quaternion, etc. math structures, which were allocated en masse every single frame for every single mathematical calculation. I forget exactly which version this happened in, but I do remember it being a problem.