private function formatMemory($bytes)
    {
        $units = ['B', 'KiB', 'MiB', 'GiB'];
        $mod = 1024;
        $power = ($bytes > 0) ? (int) floor(log($bytes, $mod)) : 0;

        return sprintf('%01.2f %s', $bytes / pow($mod, $power), $units[$power]);
    }