I've been writing Java applications since around 1995 and I have written many sizable ones that didn't require a huge amount of RAM. Of course the JVM itself is a fixed overhead which is now, what, 50MB? (but even that can be ameliorated via modularization these days), and more and more third-party libraries and frameworks are in use, all of which add to an application's footprint. And then there's the skill of the developer, lack of emphasis on design and testing, etc. When applications had a life span of years or even decades, the cost of design, testing, performance tuning, etc. was worth it. Nowadays, there's much more of an emphasis of speed-to-market and the resulting software quality and performance reflects that. But that's a general observation that doesn't just hold for Java applications - today's web apps in whatever language they're written are pretty slow and humongous in their RAM requirements. But folks don't often complain about their Google Chrome or Safari browsers reaching giga-bytes in size?!
Back in the late 90's, when Netbeans first came out, it was a *lot* smaller. But back then, life was simple. There was no groovy, maven, ivy, built-in web servers, support for web apps and frameworks, other programming languages, terminals, to-do lists, different IDE look & feels,...the list is endless - and it all adds up. Also, Java app processes reserve memory via various JVM arguments (-Xms, -Xmx, etc.) I don't know what Netbeans sets those parameters to these days, but you can adjust them yourself in the netbeans.conf file. And Netbeans may not actually be using as much memory as you see the process take up - but once a Java process claims operating system memory (e.g. it needed a lot of RAM for a particular, but temporary operation), it doesn't give it back (at least that's how it used to be). In sum, I think blaming Java for Java applications' large memory consumption is misguided. If you could write the sort of applications written in Java in other languages (and it's not at all clear you could, given the huge Java ecosystem of ready-made third-party components/functionality), and in the time allowed to write those applications, they'd probably use just as much RAM. (yes, I do understand that what I just wrote may not hold in specific application domains, but I'm making a cross-domain point). Just my $.02. Tom > On Apr 10, 2024, at 12:18 PM, Raul Cosio <rco...@gmail.com> wrote: > > That's the question I've asked myself for years... In the first versions of > Java that was a concern: Why did Netbeans use 200MB of RAM when Visual Basic > used just 10MB or less? PC's were more limited in RAM, maybe that's why Java > was not popular in desktop apps, but succeeded with web servers, where you > could afford a server with more RAM and disk drive. We had a joke at the > office: "Java was slow and used huge amounts of RAM, however, now PC's have > faster processors and lots of RAM!" :) > These days it is not uncommon to see Netbeans using 1.5GB of RAM, yes it uses > caches, precompiling, error detection, popup documentation and many more > features but it still does not make sense. > I don't know if somebody has an answer to this question but I guess it is > related to performance and GC: If you have a considerable amount of RAM > reserved, it's much faster to allocate new objects. Java is very efficient at > Object allocation, in the same way, garbage collection is so fast that you > don't even notice when it is running, so I would say: Java uses lots of RAM > because performance is more important. > Finally, I remember many years ago when a coworker went to a JBoss training > course, and he asked the instructor: Why do Java and JBoss have to use such > amounts of RAM? The instructor made a small pause and then he said > (rephrasing at today's economy): How much is a developer salary? 20-30 > dollars an hour? And, how much is a 16 GB stick of RAM? 16 dollars? Well, > just buy more RAM for your developers and let them focus on solving business > problems... > > > On Wed, Apr 10, 2024 at 3:32 AM Tom <mac...@t-online.de > <mailto:mac...@t-online.de>> wrote: >> Why does Java and Netbeans use extreme amounts of RAM for simple apps? >> Can there be done something about it? >> >> --------------------------------------------------------------------- >> To unsubscribe, e-mail: users-unsubscr...@netbeans.apache.org >> <mailto:users-unsubscr...@netbeans.apache.org> >> For additional commands, e-mail: users-h...@netbeans.apache.org >> <mailto:users-h...@netbeans.apache.org> >> >> For further information about the NetBeans mailing lists, visit: >> https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists >>