public static long calculateTotalProcessMemoryFromComponents(Configuration config) {
        Preconditions.checkArgument(config.contains(TaskManagerOptions.JVM_METASPACE));
        Preconditions.checkArgument(config.contains(TaskManagerOptions.JVM_OVERHEAD_MAX));
        Preconditions.checkArgument(config.contains(TaskManagerOptions.JVM_OVERHEAD_MIN));
        Preconditions.checkArgument(
                config.get(TaskManagerOptions.JVM_OVERHEAD_MAX)
                        .equals(config.get(TaskManagerOptions.JVM_OVERHEAD_MIN)));
        return calculateTotalFlinkMemoryFromComponents(config)
                + config.get(TaskManagerOptions.JVM_METASPACE)
                        .add(config.get(TaskManagerOptions.JVM_OVERHEAD_MAX))
                        .getBytes();
    }
@Test
    void testCalculateTotalProcessMemoryWithAllFactorsBeingSet() {
        Configuration config = new Configuration();

        config.set(TaskManagerOptions.FRAMEWORK_HEAP_MEMORY, new MemorySize(1));
        config.set(TaskManagerOptions.TASK_HEAP_MEMORY, new MemorySize(2));
        config.set(TaskManagerOptions.FRAMEWORK_OFF_HEAP_MEMORY, new MemorySize(3));
        config.set(TaskManagerOptions.TASK_OFF_HEAP_MEMORY, new MemorySize(4));
        config.set(TaskManagerOptions.NETWORK_MEMORY_MAX, new MemorySize(6));
        config.set(TaskManagerOptions.NETWORK_MEMORY_MIN, new MemorySize(6));
        config.set(TaskManagerOptions.MANAGED_MEMORY_SIZE, new MemorySize(7));
        config.set(TaskManagerOptions.JVM_METASPACE, new MemorySize(8));
        config.set(TaskManagerOptions.JVM_OVERHEAD_MAX, new MemorySize(10));
        config.set(TaskManagerOptions.JVM_OVERHEAD_MIN, new MemorySize(10));

        assertThat(TaskExecutorResourceUtils.calculateTotalProcessMemoryFromComponents(config))
                .isEqualTo(41L);
    }