Others already have written good points to this question. I just want to
add my 2 cents.
Netbeans is doing a lot of stuff in the background and it's using a
significant amount of RAM for speeding things up. A professor of mine
once said something like "If you have a lot of RAM and you don't use it
to do useful things, why did you have bought it in the first place?".
What he wanted to say was: of course no one should waste RAM to do
senseless things or because he just has forgotten to free it up again
and the like. But, if you can do useful things with it, e.g. to speed
things up significantly, then do it! ;-) Especially these days, when RAM
is cheap.
On the other hand, some Java applications are indeed wasting RAM,
because of mistakes done by the developers. Back in my days, when I
started to learn Java during my studies, people were saying "Java is
nice. You don't have to take care about freeing memory any more because
the garbage collector is doing it for you". Although this statement is
not exactly false, it led to a careless handling of memory by some
developers. Because of the garbage collection it is very important to
place the variables and objects in the right scope. A globally scoped
object is never freed. A class static member is never freed, once the
class is loaded. A class member is freed together with its object
instance. An object instance is freed after the instance is not
referenced by any other instance any more. Especially the last thing is
a pitfall for some developers. This means for example: sometimes there
is just this "small little object" in the session scope or global scope.
But the developer has forgotten (or never knew it, because this class
was written by a different developer) that this small object (even if
only some bytes in size) may have one single reference to another
object, let's say a Collection with thousands or millions of entries in
it. Then this small global object of 50 bytes is the cause that the
big Collection (with maybe even more big references and so maybe up to
MBs or even GBs) behind it will never be freed by the garbage collection.
This is basic knowledge a Java programmer has to have in mind, I know.
But even experienced developers sometimes fall into this because
especially in big projects it is easy to oversee a small little
reference to a hidden big object, or to misinterpret the lifetime of one
instance... "oh I didn't know this instance is although referenced by
this long running thread although the thread is only needing it to start
up, etc. pp.".
cu
Jens
Am 10.04.2024 um 11:31 schrieb Tom:
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
For additional commands, e-mail: users-h...@netbeans.apache.org
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@netbeans.apache.org
For additional commands, e-mail: users-h...@netbeans.apache.org
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists