---
title: "CFAllocatorDeallocate(_:_:)"
framework: corefoundation
role: symbol
role_heading: Function
path: "corefoundation/cfallocatordeallocate(_:_:)"
---

# CFAllocatorDeallocate(_:_:)

Deallocates a block of memory with a given allocator.

## Declaration

```swift
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

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.

## See Also

### Managing Memory with an Allocator

- [CFAllocatorAllocate(_:_:_:)](corefoundation/cfallocatorallocate(_:_:_:).md)
- [CFAllocatorGetPreferredSizeForSize(_:_:_:)](corefoundation/cfallocatorgetpreferredsizeforsize(_:_:_:).md)
- [CFAllocatorReallocate(_:_:_:_:)](corefoundation/cfallocatorreallocate(_:_:_:_:).md)
