<!--
{
  "availability" : [
    "iOS: 6.0.0 -",
    "iPadOS: 6.0.0 -",
    "macCatalyst: 13.1.0 -",
    "macOS: 10.5.0 -",
    "tvOS: 9.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 2.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Foundation",
  "identifier" : "/documentation/Foundation/NSPointerFunctions",
  "metadataVersion" : "0.1.0",
  "role" : "Class",
  "symbol" : {
    "kind" : "Class",
    "modules" : [
      "Foundation"
    ],
    "preciseIdentifier" : "c:objc(cs)NSPointerFunctions"
  },
  "title" : "NSPointerFunctions"
}
-->

# NSPointerFunctions

An instance of `NSPointerFunctions` defines callout functions appropriate for managing a pointer reference held somewhere else.

```
class NSPointerFunctions
```

## Overview

The functions specified by an instance of `NSPointerFunctions` are separated into two clusters—those that define “personality” such as “object” or “C-string”, and those that describe memory management issues such as a memory deallocation function. There are constants for common personalities and memory manager selections (see `Memory and Personality Options`).

[`NSHashTable`](/documentation/Foundation/NSHashTable), [`NSMapTable`](/documentation/Foundation/NSMapTable), and [`NSPointerArray`](/documentation/Foundation/NSPointerArray) use an `NSPointerFunctions` object to define the acquisition and retention behavior for the pointers they manage. Note, however, that not all combinations of personality and memory management behavior are valid for these collections. The pointer collection objects copy the `NSPointerFunctions` object on input and output, so you cannot usefully subclass `NSPointerFunctions`.

### Subclassing Notes

`NSPointerFunctions` is not suitable for subclassing.

## Topics

### Creating and Initializing an NSPointerFunctions Object

[`-  initWithOptions:`](/documentation/Foundation/NSPointerFunctions/init(options:))

Returns an `NSPointerFunctions` object initialized with the given options.

[`+  pointerFunctionsWithOptions:`](/documentation/Foundation/NSPointerFunctions/pointerFunctionsWithOptions:)

Returns a new `NSPointerFunctions` object initialized with the given options.

### Personality Functions

[`hashFunction`](/documentation/Foundation/NSPointerFunctions/hashFunction)

The hash function.

[`isEqualFunction`](/documentation/Foundation/NSPointerFunctions/isEqualFunction)

The function used to compare pointers.

[`sizeFunction`](/documentation/Foundation/NSPointerFunctions/sizeFunction)

The function used to determine the size of pointers.

[`descriptionFunction`](/documentation/Foundation/NSPointerFunctions/descriptionFunction)

The function used to describe elements.

### Memory Configuration

[`acquireFunction`](/documentation/Foundation/NSPointerFunctions/acquireFunction)

The function used to acquire memory.

[`relinquishFunction`](/documentation/Foundation/NSPointerFunctions/relinquishFunction)

The function used to relinquish memory.

[`usesStrongWriteBarrier`](/documentation/Foundation/NSPointerFunctions/usesStrongWriteBarrier)

Specifies whether, in a garbage collected environment, pointers should be assigned using a strong write barrier.

[`usesWeakReadAndWriteBarriers`](/documentation/Foundation/NSPointerFunctions/usesWeakReadAndWriteBarriers)

Specifies whether, in a garbage collected environment, pointers should use weak read and write barriers.

### Constants

[`Options`](/documentation/Foundation/NSPointerFunctions/Options)

Defines the memory and personality options for an `NSPointerFunctions` object.

## Relationships

### Conforms To

[`Hashable`](/documentation/Swift/Hashable)

[`CustomDebugStringConvertible`](/documentation/Swift/CustomDebugStringConvertible)

[`CustomStringConvertible`](/documentation/Swift/CustomStringConvertible)

[`Equatable`](/documentation/Swift/Equatable)

[`NSCopying`](/documentation/Foundation/NSCopying)

[`NSObjectProtocol`](/documentation/ObjectiveC/NSObjectProtocol)

[`CVarArg`](/documentation/Swift/CVarArg)

### Inherits From

[`NSObject-swift.class`](/documentation/ObjectiveC/NSObject-swift.class)

---

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)