---
title: "PMRetain(_:)"
framework: applicationservices
role: symbol
role_heading: Function
path: applicationservices/1460190-pmretain
---

# PMRetain(_:)

Retains a printing object by incrementing its reference count.

## Declaration

```swift
func PMRetain(_ object: PMObject?) -> OSStatus
```

## Parameters

- `object`: The printing object you want to retain.

## Return Value

Return Value A result code. See Result Codes.

## Discussion

Discussion You should retain a printing object when you receive it from elsewhere (that is, you did not create or copy it) and you want it to persist. If you retain a printing object, you are responsible for releasing it. (See PMRelease.) You can use the function PMRetain to increment a printing object’s reference count so that multiple threads or routines can use the object without the risk of another thread or routine deallocating the object.

## See Also

### Releasing and Retaining Printing Objects

- [PMRelease(_:)](applicationservices/1461402-pmrelease.md)
