<!--
{
  "availability" : [
    "iOS: -",
    "iPadOS: -",
    "macCatalyst: -",
    "macOS: -",
    "tvOS: -",
    "visionOS: -",
    "watchOS: -"
  ],
  "documentType" : "symbol",
  "framework" : "CoreFoundation",
  "identifier" : "/documentation/CoreFoundation/CFAllocatorDeallocate(_:_:)",
  "metadataVersion" : "0.1.0",
  "role" : "Function",
  "symbol" : {
    "kind" : "Function",
    "modules" : [
      "Core Foundation"
    ],
    "preciseIdentifier" : "c:@F@CFAllocatorDeallocate"
  },
  "title" : "CFAllocatorDeallocate(_:_:)"
}
-->

# CFAllocatorDeallocate(_:_:)

Deallocates a block of memory with a given allocator.

```
func CFAllocatorDeallocate(_ allocator: CFAllocator!, _ ptr: UnsafeMutableRawPointer!)
```

## Parameters

`allocator`

The allocator that was used to allocate the block of memory pointed to by `ptr`.

`ptr`

An untyped pointer to a block of memory to deallocate using `allocator`.

## Discussion

If the allocator does not specify a `deallocate` callback function, the memory is not deallocated.

### Special Considerations

You must use the same allocator to deallocate memory as was used to allocate it.

---

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)