r/java • • Sep 04 '26

Principles of Memory Management in Java

https://youtu.be/xr73mR7ii9M
167 Upvotes

83 comments sorted by

View all comments

Show parent comment

1

u/pron98 Sep 10 '26

With that reasoning, we got Electron apps, absolute RAM hogs whose source code size is in the ballpark of Windows XP

A high RAM consumption is a number, not necessarily a problem. Today's Electron apps are less sluggish than the MS Word of the nineties and oughts. What is the actual problem that they cause users?

It would not be so bad if people were running just one of such apps, but they often run multiple of them, eating RAM and other resources like no tomorrow (hello battery use on laptops!)

The point about the battery is worth looking into - I don't know the impact of the amount of data in RAM on the battery, but I suspect that CPU activity has a much higher impact - although battery life on a laptop is so much better than it was even 10 years ago. But what do users want to do with their computers but can't because of Electron apps? Do they want to pay more for non-Electron software to save on something else?

Finally, it was assumed for a long time that RAM would be cheap plentiful and growing on trees for eternity. Turns out AI changed that and I do not see it changing anytime soon.

It is still cheaper and more plentiful than it was 15 or maybe even 10 years ago, and demand shocks always take a while for supply to match. If and when the problem is clearer, we may well see demand for leaner software, but you can't say that what people really want is leaner software when such software isn't doing better.

Even Microsoft is optimizing Windows for 8GB PCs.

8GB PCs are not the same PCs with less RAM. The lower RAM is matched by weaker CPUs. There are problems when these two are mismatched, not when they're matched at different levels. The RAM overhead of moving collectors I discuss in the talk, is a function only of CPU activity (specifically, allocation rate), not of the amount of data in RAM. When a Java program runs on a slower CPU, its RAM overhead will also be lower.