Was calculating the “used heap” based on max heap size and not on the currently allocated size.
Signed-off-by: Matthew Skinner <matt@pcmus.com>
state = new QuantityType<>(Runtime.getRuntime().freeMemory(), Units.BYTE);
break;
case CHANNEL_MEMORY_USED_HEAP_PERCENT:
- state = new DecimalType((Runtime.getRuntime().maxMemory() - Runtime.getRuntime().freeMemory()) * 100
- / Runtime.getRuntime().maxMemory());
+ state = new DecimalType((Runtime.getRuntime().totalMemory() - Runtime.getRuntime().freeMemory())
+ * 100 / Runtime.getRuntime().maxMemory());
break;
case CHANNEL_DISPLAY_INFORMATION:
state = systeminfo.getDisplayInformation(deviceIndex);