# GetTempMemoryHandle()

> Gets an AtomicSafetyHandle for the temporary memory allocations in a temporary memory scope.

## Definition

* **Type:** Method
* **Namespace:** [Unity.Collections.LowLevel.Unsafe](/engine/6000.3/script-reference/unity/collections/lowlevel/unsafe.md)
* **Assembly:** UnityEngine.CoreModule

```csharp
public static AtomicSafetyHandle GetTempMemoryHandle()
```

### Returns

| Type                                                                                                          | Description                                                                   |
| ------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------- |
| [AtomicSafetyHandle](/engine/6000.3/script-reference/unity/collections/lowlevel/unsafe/atomicsafetyhandle.md) | The AtomicSafetyHandle for temporary memory allocations in the current scope. |

### Remarks

The temporary safety handle is invalidated when the temporary memory is freed. This happens when the active temporary memory scope exists, which happens at least once per frame. Don't manually call [AtomicSafetyHandle.Release](/engine/6000.3/script-reference/unity/collections/lowlevel/unsafe/atomicsafetyhandle/release.md) on this AtomicSafetyHandle.

Additional Resources: [AtomicSafetyHandle.IsTempMemoryHandle](/engine/6000.3/script-reference/unity/collections/lowlevel/unsafe/atomicsafetyhandle/istempmemoryhandle.md).
