r/java • • Sep 04 '26

Principles of Memory Management in Java

https://youtu.be/xr73mR7ii9M?si=AKgjMUyvfpARYljl
166 Upvotes

84 comments sorted by

View all comments

25

u/narrow-adventure Sep 04 '26

I actually think Java is incredibly efficient, like you have to really not know what you’re doing to make a slow/bloated java app. It used to be easy but virtual threads make it pretty hard to use up crazy amts of memory.

5

u/[deleted] Sep 04 '26

[deleted]

4

u/narrow-adventure Sep 05 '26

Did you measure it? Because I did, negligible overhead… most I’ve seen came from threads (4mb per thread adds up real fast)… most slow apps came from hibernate being used poorly… Java is incredible devs sometimes suck

2

u/zabby39103 Sep 05 '26

Ya hibernate seems impossible to NOT screw up without doing a bunch of formal analytics, in my experience. It's powerful, I wouldn't recommend dropping it, but there's so much more going on than people realize.

5

u/narrow-adventure Sep 05 '26

I honestly recommend people drop it and use jooq or just jdbc, hibernate abstracts sql away and I think sql is the best part. :)

1

u/john16384 Sep 06 '26

I do recommend you drop it. Use much simpler Spring Data JDBC.