public double memoryOverhead(VespaFlavor hostFlavor, NodeResources resources, boolean real) {
        double hostMemoryOverhead =
                hostFlavor.advertisedResources().memoryGiB() - hostFlavor.realResources().memoryGiB()
                + hostMemory; // Approximate cost of host administration processes

        if (hostMemoryOverhead > hostFlavor.advertisedResources().memoryGiB()) // An unusably small flavor,
            return resources.memoryGiB(); // all will be overhead
        double memoryShare = resources.memoryGiB() /
                             ( hostFlavor.advertisedResources().memoryGiB() - ( real ? hostMemoryOverhead : 0));
        if (memoryShare > 1) // The real resources of the host cannot fit the requested real resources after overhead
            memoryShare = 1;

        return hostMemoryOverhead * memoryShare;
    }
Returns the memory overhead resulting if the given resources are placed on the given node

@param real true if the given resources are in real values, false if they are in advertised
node-repository/src/test/java/com/yahoo/vespa/hosted/provision/autoscale/awsnodes/AwsResourcesCalculator.java