<!--
{
  "availability" : [
    "macOS: 11.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "EndpointSecurity",
  "identifier" : "/documentation/EndpointSecurity/es_retain_message(_:)",
  "metadataVersion" : "0.1.0",
  "role" : "Function",
  "symbol" : {
    "kind" : "Function",
    "modules" : [
      "Endpoint Security"
    ],
    "preciseIdentifier" : "c:@F@es_retain_message"
  },
  "title" : "es_retain_message(_:)"
}
-->

# es_retain_message(_:)

Retains the given message, extending its lifetime until released.

```
func es_retain_message(_ msg: UnsafePointer<es_message_t>)
```

## Parameters

`msg`

The message to retain.

## Discussion

If you asynchronously process the message provided to the event-handler block of [`es_new_client(_:_:)`](/documentation/EndpointSecurity/es_new_client(_:_:)), you must retain the message.

---

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)