Kathey Marsden wrote:
Kathey Marsden wrote:

Also I think I might try to gc() before the measurements and see if that makes a difference, but it seems to me that would only make the value larger.

putting runtime.gc() and runtime.runFinalization() before the calls to totalMemory() and freeMemory() seem to stabilize it at 4.

Does that seem like a reasonable solution? The static block is only called once so it shouldn't impact performance I think.

Can we use the system property "os.arch" to determine this?

I haven't confirmed this, but tried it on a few machines. As far as I can see, it returns the "architecture" of the JVM begin run.
So far I have seen these values (all Sun JVMs):
   (machine #1)
   Solaris 10 - x86 32 bit VM: "x86"
   Solaris 10 - x86 64 bit VM: "amd64"
   (machine #2)
   Solaris 10 - sparc 32 bit VM: "sparc"
   Solaris 10 - sparc 64 bit VM: "sparcv9"
   (machine #3)
   Linux x86 32 bit VM: "i386"

If we don't recognize the value we get, we can run the heuristic.
I haven't found any authoritative source/description of the values, but we could try to check the source of some of the open-sourced VMs if we want to investigate further.

People can also help out by posting the value of "os.arch" seen on their computer :)


just a thought,
--
Kristian


Kathey



Reply via email to