9

Why is netbeans, or Java in general, so fucking bad at handling memory ? I mean, I'm literally doing nothing on my code and I see my IDE consuming more and more RAM, to some point it goes over 1GB so I have to close then reopen it to "flush" the memory taken...
It's 2017, how the fuck can't we still manage to actually use a correct amount of RAM when I open a barely 10MB project ??

And it applies to everything related to Java. Like Android, Minecraft and other Java based softwares...

Comments
  • 4
    Why do you assume that Netbeans "does nothing"? It could be the index service that runs in the background. Also you can set the maximum amount of memory the jvm should consume.

    It also sounds like your hardware is out of date, if it concerns you that 1GB of memory is used.
  • 1
    @Makenshi I'm not saying netbeans does nothing, I do nothing, but it keeps sucking RAM. It can index whatever it wants, but why would it consume so much of RAM ?
    My hardware isn't out of date, I have 8GB, SSD and an i5 laptop. I have chrome and other softwares running at the same time too. RAM is usually taken at 50-60%, mostly because of netbeans.
    Sublime text, notepad or whatever other software don't do random or increasing RAM consumption like netbeans does. That's what really annoy me.
    I don't change my IDE though, because as far as I know, it's the only free IDE that has the features I need.
  • 5
    I always see this and I never understand the point. Even after netbeans is taking all those memory you still have 50-40% ram left. Unused memory is wasted memory. jvm keep caching memory unless the os is asking for it so that it can perform operations faster. Unless it's slowing your computer down, it's absolutely fine to take as much memory as it wants.

    Wait a sec, why are you using netbeans?
  • 0
    @Strannch And why exactly do you worry about 1GB Ram when you have 8GB?

    The OS can manage memory quite well on its own and it's not like unused Ram speeds up your computer, quite the opposite.
  • 3
    Unused ram is wasted potential. String things in RAM is faster than accessing them from the hard drive. So keeping those files that you often use in memory makes more sense. And for the netbeans concerns, netbeans has some memory leaks already reported. Quite hard to fix those in such a big application if you have no clue from where they come.
  • 2
    @Strannch There are many factors for memory usage. Looking at the memory usage of Netbeans with one project open, it uses 787 MB atm.

    It really depends how big your projects are, how many plugins are installed, how many background processes are running and so forth.

    Simply generalizing that every Java application has bad memory management is simply false. If you keep in mind that the JVM is running for Netbeans to make it plattform independent, it is quite a good value. 1GB of Ram is nothing in today's world.
  • 0
    @Jase I agree with you: native code = best code ^^

    That's why I'm doing all my projects in C++ :P
  • 2
    Personally if I could have used xamarin to redo the app at work from scratch I would have being the only developer I don't really want to implement the same features twice, that aside Android studio doesn't seem as bad, I don't see why people want to do memory checks on the ide, I don't want this to go down the argument route but it is indeed 2017 maybe more ram is a choice for your next upgrade?

    Not defending that java has memory issues and all look at Minecraft, but I'm sure there are some ways to improve memory usage.
  • 1
    @f03n1x in general, it makes no sense to trigger any garbage collection until the heap is completely full. No calculation time is wasted, no resources are wasted. GC in Java is really really good nowadays. It sucked earlier on, but Java 8 pushed it quite hard, same will do Java 9. It includes some GC optimizations. The OS will for sure know when to release and allocate new RAM to programs. There is no need to manually flush the RAM and remove the ability to maybe reuse the already loaded data. That's just a fact lol. JVM got really small, sure it takes more RAM than native code because it has the JVM running in the background doing its thing. But other cross platform languages/frameworks have the same if not even more overhead. QT for example is as big as Java. Not sure how large C#/Mono is and what's it initial memory usage is but that doesn't matter. Choosing a language based on RAM usage is in most circumstances wrong. And if you need to take care of RAM usage you should go native.
  • 2
    @SirWindfield ah okay that's good to know, wish the people that kept posting hate on how java is bad for memory would at least learn this :/

    I didn't realize java 8 did a better job of garbage collection, guess I'll have to play around with it, though tbh I haven't used java in awhile and last time I did memory wasn't much of an issue to begin with.

    Every language has it's​ uses good/bad sides, people need to at least except that
  • 1
    @f03n1x that's the thing. "almost" all bad hate comes from the early age of Java. It was insecure, it was slower than native code, it was memory leaking. But nowadays, it runs almost as fast as C code thanks to JIT (just in time) compilation. It compiles highly used code to native code and executes that, improving execution times. And by almost as fast I mean just some milliseconds. Java 8 made the default GC way more aggressive than before. And with Java 9 and the modularization of the whole runtime means that you can distribute Java applications that can take less then 10MB disk space. They developed tools to remove all unnecessary modules that are not needed by your program, called linker. It then bundles the needed code into a custom JrE image. Quite nice for distributing. I like Java, it definitely has its flaws, but calling it bad in general is just unfair.
  • 1
    @SirWindfield to clarify, the jre consists of multiple modules, like java.base for all vase classes, java.net for networking, javafx.core for javafx stuff. Separated all by package and usage type.
  • 2
    @SirWindfield awesome thanks for me giving the heads up, it's great to hear java is going in the right direction :D personally loved coding in java back at uni, may have to start some sort of project in java to really give it a go, it has been quite awhile.

    @Strannch I just googled free java IDEs and found a webpage listing 11 of them, though it doesn't have a timestamp I'd say at least look around, there should be something that'd meet your expectations, I know people at uni used eclipse so you could give that a go. I've used it for making a Minecraft mod, it was only a 3-day project but it works relatively well.

    @KnightsOfCode forgot to add, you could try c++ for Android development, it's just Android studio does handle a couple things (Gradle setting up was a pain for me with c++) better and let's you get on with coding
  • 0
    Who the fuck uses netbeans
  • 3
    @f03n1x jetbrains community edition, by far the best Java idea out there.
  • 3
    @KalmyK I did for majority of my University projects, didn't really explore different options though

    @SirWindfield I'm going to install that when I go home cheers!
  • 1
  • 0
    @Krokoklemme I am so sorry for you;) no offense
Add Comment