code: private static long getSizeOfFreeMemory() {
  		float fractionToUse = GlobalConfiguration.getFloat(
  			ConfigConstants.TASK_MANAGER_MEMORY_FRACTION_KEY, ConfigConstants.DEFAULT_MEMORY_MANAGER_MEMORY_FRACTION);
  		
  		Runtime r = Runtime.getRuntime();
  		long max = r.maxMemory();
  		long total = r.totalMemory();
  		long free = r.freeMemory();
  		
  		long available = max - total + free;
  		return (long) (fractionToUse * available);
  	}
docs: Returns the size of free memory in bytes available to the JVM.
  
  @return the size of the free memory in bytes available to the JVM or <code>-1</code> if the size cannot be
  determined