docs: double getMemoryLimitSize(String sizeStr)
      {
          if (sizeStr==null || sizeStr.length()==0) {
              return 0;
          }
  
          try {
              if (sizeStr.charAt(sizeStr.length()-1)=='%') { // size as a percentage of total available memory
                  int perc = Integer.parseInt(sizeStr.substring(0, sizeStr.length()-1));
                  if (perc<0 || perc > 99) {
                      throw new IllegalArgumentException("Invalid memory limit percentage: " + sizeStr);
                  }
                  return PlatformProperties.getPlatformProperties().ramInMegabytes*1048576L*perc/100.0;
              } else { // size in GB
                  double size = Double.parseDouble(sizeStr)*1073741824L;
                  if (size<0) {
                      throw new IllegalArgumentException("Invalid memory limit value: " + sizeStr);
                  }
                  return size;
              }
          } catch(NumberFormatException e) {
              throw new IllegalArgumentException("Invalid memory limit value " + sizeStr +
                      ". Memory limit must be configued as a percentage of total available memory or as GB value");
          }
      }