NetBeans IDE has a taskbar indicaror, showing how much RAM is currently allocated and used by the running instance. How can I get this data in my own application written in Scala? If there's no special function for this in Scala, I could use Java one.
views:
110answers:
2
+3
A:
You can either use the totalMemory and maxMemory methods from the java.lang.Runtime class, or make use of the MemoryMXBean.
Michael Barker
2010-09-05 01:58:44
+3
A:
private val runtime = Runtime.getRuntime()
import runtime.{ totalMemory, freeMemory, maxMemory }
System.out.println("New session, \
total memory = %s, max memory = %s, free memory = %s".format(
totalMemory, maxMemory, freeMemory))
Just copied from http://harrah.github.com/browse/samples/compiler/scala/tools/nsc/CompileServer.scala.html
The MYYN
2010-09-05 02:00:02