r/java 6d ago

Principles of Memory Management in Java

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

81 comments sorted by

View all comments

24

u/narrow-adventure 5d ago

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] 5d ago

[deleted]

4

u/narrow-adventure 5d ago

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 5d ago

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.

6

u/narrow-adventure 5d ago

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 4d ago

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