# CheckGetSecondaryDataPointerAndThrow(AtomicSafetyHandle)

> Check whether it's safe to create a memory-aliasing view to a native container.

## Definition

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

```csharp
[Conditional("ENABLE_UNITY_COLLECTIONS_CHECKS")]
public static void CheckGetSecondaryDataPointerAndThrow(AtomicSafetyHandle handle)
```

### Parameters

**** (\[AtomicSafetyHandle]\(/engine/6000.3/script-reference/unity/collections/lowlevel/unsafe/atomicsafetyhandle)): The AtomicSafetyHandle to check.

### Remarks

Use this method when you implement native container methods that create memory-aliasing views, such as `GetEnumerator` or `AsArray`. This method checks whether it is safe to copy the data pointer to the backing memory of the native container into a new view structure that uses the secondary version number.

This method checks if there are pending jobs that might affect the size of the native container and risk reallocating the container's backing memory. This method doesn't throw an exception if the job writes through an `AtomicSafetyHandle` that uses a secondary version number.

The difference between this method and `<see cref="Unity.Collections.LowLevel.Unsafe.AtomicSafetyHandle.CheckReadAndThrow"></see>` is that that `CheckReadAndThrow` throws an exception if there are any pending jobs writing to the native container. `CheckGetSecondaryDataPointerAndThrow` throws an exception only if there is a risk of a job reallocating the native container's backing memory, which makes the data pointer copied to the view invalid.

For more information about secondary version numbers and safe access to dynamic containers, refer to [Copying NativeContainer structures](/engine/6000.3/manual/scripting/programming-distribute-work-threads/job-system/thread-safe-types/copy-nativecontainer.md).

Additional Resources: [NativeContainerAttribute](/engine/6000.3/script-reference/unity/collections/lowlevel/unsafe/nativecontainerattribute.md).
