# What are the initialised values of numba.cuda.device\_array()?

**URL:** <https://numba.discourse.group/t/what-are-the-initialised-values-of-numba-cuda-device-array/1260>\
**Category:** Community Support\
**Created:** [March 21, 2022, 11:37am UTC](https://numba.discourse.group/t/what-are-the-initialised-values-of-numba-cuda-device-array/1260 "2022-03-21T11:37:48Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![S-ML](https://yyz2.discourse-cdn.com/free1/user_avatar/numba.discourse.group/s-ml/32/537_2.png) [@S-ML](https://numba.discourse.group/u/S-ML)\
**Post date:** [March 21, 2022, 11:37am UTC](https://numba.discourse.group/t/what-are-the-initialised-values-of-numba-cuda-device-array/1260/1 "2022-03-21T11:37:48Z")

</div>

The documentation for creating an empty array on the GPU with `numba.cuda.device_array()` describes the function as:

> Allocate an empty device ndarray. Similar to `numpy.empty()`.

From my own tests the created CUDA array is filled with zeros, which is unlike the behaviour of numpy.empty() that fills an array “without initializing entries”.

What are the initialised values of the array produced by `numba.cuda.device_array()`? Can I rely on them being zero every time?

PS I am unable to to include links to relevant documentations.

---

<div class="post-metadata">

**Author:** ![gmarkall](https://yyz2.discourse-cdn.com/free1/user_avatar/numba.discourse.group/gmarkall/32/42_2.png) [@gmarkall](https://numba.discourse.group/u/gmarkall)\
**Post date:** [March 25, 2022, 5:22pm UTC](https://numba.discourse.group/t/what-are-the-initialised-values-of-numba-cuda-device-array/1260/2 "2022-03-25T17:22:21Z")

</div>

IIRC memory allocated with `cuMemAlloc` (which Numba’s default memory manager uses under the hood) is scrubbed for security reasons (i.e. not leaking information between users / processes).

However, this can’t be relied on in general because an external memory manager might be in use, which could well be providing allocations from a pool - there is nothing to prevent a pool allocator from reusing portions of the pool that have become non-zero.
