fft1976 said:
I was under the impression that JVM had a fixed memory overhead per
process, and maybe a small (2-fold or so?) overhead for the data
structures.
That's not how it works. You haven't answered my questions upthread, though.
Java is a whole virtual computer inside the physical one. You have to have
memory for the JVM itself, for the classes that it loads, many of which are
needed no matter what programs it might run, for the various heap generations,
and for the program itself.
Some other shootout entries use less than 1MB, so the fixed overhead
should be small. (The linked entry uses very few libraries, by the
way).
Did those other entries count the memory they needed for the computer OS itself?
The data structures needed here are perhaps 0.1KB in size. So, again,
why 15MB and not 1MB or so?
Again, as I hinted upthread and am now saying outright, that 15 MB might very
well include overhead for the JVM itself. It has to load a whole bytecode
interpreter, the Hotspot compiler, various heap structures and some
fundamental classes before it can even begin to load the application.
And would the memory usage go up to 150MB if the data structures were
ten times larger?
If my guesses have any bearing on reality, and I really don't know if they do
with respect to this "shootout", then no. It'll go up to about 15.01 MB.
How about you answer the questions I asked:
What is meant here by "using 15MB"? Total for the JVM? Heap?
Classes plus heap?
Remember, don't compare apples to bicycles. I doubt very much the "shootout"
is comparing just the memory used by Java for the application; most likely
it's counting the whole overhead of loading the Java computer within the host
computer.