<!--
{
  "availability" : [
    "iOS: 9.0.0 -",
    "iPadOS: 9.0.0 -",
    "macCatalyst: 13.1.0 -",
    "macOS: 10.11.0 -",
    "tvOS: 9.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 2.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Compression",
  "identifier" : "/documentation/Compression/compression_decode_scratch_buffer_size(_:)",
  "metadataVersion" : "0.1.0",
  "role" : "Function",
  "symbol" : {
    "kind" : "Function",
    "modules" : [
      "Compression"
    ],
    "preciseIdentifier" : "c:@F@compression_decode_scratch_buffer_size"
  },
  "title" : "compression_decode_scratch_buffer_size(_:)"
}
-->

# compression_decode_scratch_buffer_size(_:)

Returns the required decompression scratch buffer size for the selected algorithm.

```
func compression_decode_scratch_buffer_size(_ algorithm: compression_algorithm) -> Int
```

## Parameters

`algorithm`

A constant of type [`compression_algorithm`](/documentation/Compression/compression_algorithm) that specifies the compression algorithm.

## Return Value

Size in bytes.

## Discussion

This function returns the number of bytes to provide in an optional scratch buffer when calling [`compression_decode_buffer(_:_:_:_:_:_:)`](/documentation/Compression/compression_decode_buffer(_:_:_:_:_:_:)).

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)