How do I check how much resources a java program uses?
In java it is quite easy to create a big nice program that does practically everything you want it to, but a little side effect is that is also very easy to indirectly allocate to much memory and cpu cycles by mistake (i.e. let's just use "new" a couple of times in the wrong place).
And if the program are supposed to run in a environment with very limited amount of resources, let's say something embedded or maybe a mobile phone (J2ME, Android etc etc), it is crucial to know how resource hungry your program is.
Note: Since my main focus has been c the last years I could be missing something very simple here, so please don't assume to much ;)
Thanks Johan
maxMemory();
totalMemory();
freeMemory();
You appear to be somewhat confused about what you really need. In your question I sense some uneasiness about "how many resources will Java gobbly up behind my back to bite me later?".
The answer to this is, to paraphrase Douglas Adams: "Dont' panic!" :-).
Seriously, Java does not necessarily use much more resources than a "native" application, so you probably need not worry.
A quick rundown:
Short version: Don't worry, just do as you always do: Make it run, make it run correctly, make it run fast (by profiling).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With