Hi Max,

On 12/10/2011 5:15 AM, Weijun Wang wrote:
I have a test consuming quite a lot of memory and seems to be only
working on server vms. I've added

String vm = System.getProperty("java.vm.name");
if (!vm.equals("Java HotSpot(TM) Server VM")) {
  System.out.println("The test only runs on server VMs");
  return;
}

Is there a better way to detect it?

Searching for contains("Server") would be less error-prone as the above will not work on 64-bit. But there is a better property to use:

sun.management.compiler

which will report eg "Hotspot Client Compiler". However, these days both properties might report Tiered rather than Server. Also for -Xint sun.management.compiler doesn't exist.

That all said this seems like the wrong solution to the problem. Amount of memory used shouldn't be that dependent on client vs. server VM

David

Reply via email to