# Why does GPU allocate so much for me?

**URL:** <https://discourse.julialang.org/t/why-does-gpu-allocate-so-much-for-me/93681>\
**Category:** GPU\
**Created:** [January 28, 2023, 9:40am UTC](https://discourse.julialang.org/t/why-does-gpu-allocate-so-much-for-me/93681 "2023-01-28T09:40:10Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ahmed\_Salih](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ahmed_salih/32/206579_2.png) [@Ahmed\_Salih](https://discourse.julialang.org/u/Ahmed_Salih)\
**Post date:** [January 28, 2023, 9:40am UTC](https://discourse.julialang.org/t/why-does-gpu-allocate-so-much-for-me/93681/1 "2023-01-28T09:40:10Z")

</div>

Hello!

Probably a noob question, but got to ask 🙂

Suppose I have:

```julia
using CUDA

N = 10^6

AGPU = CuArray(rand(N))
BGPU = CuArray(rand(N))

ACPU = rand(N)
BCPU = rand(N)

# Why does GPU allocate so much more in-place?

@allocated AGPU .= BGPU
1408 # after first run

@allocated ACPU .= BCPU
32 # after first run

```

I am surprised that CPU allocates a bit even, but I don’t get the GPU allocation at all? How do I pass values in place without using a kernel?

Kind regards

---

<div class="post-metadata">

**Author:** ![Ahmed\_Salih](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ahmed_salih/32/206579_2.png) [@Ahmed\_Salih](https://discourse.julialang.org/u/Ahmed_Salih)\
**Post date:** [January 28, 2023, 9:41am UTC](https://discourse.julialang.org/t/why-does-gpu-allocate-so-much-for-me/93681/2 "2023-01-28T09:41:35Z")

</div>

Okay, I am leaving the question up here, even though I think I found the solution, because someone might ask 🙂

```julia
CUDA.@allocated AGPU .= BGPU
0 #so use CUDA.@allocated

```
