# Why does \`similar(::SharedArray)\` create an \`Array\`?

**URL:** <https://discourse.julialang.org/t/why-does-similar-sharedarray-create-an-array/6673>\
**Category:** General Usage\
**Tags:** question\
**Created:** [October 25, 2017, 7:44am UTC](https://discourse.julialang.org/t/why-does-similar-sharedarray-create-an-array/6673 "2017-10-25T07:44:13Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![ranocha](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ranocha/32/35588_2.png) [@ranocha](https://discourse.julialang.org/u/ranocha)\
**Post date:** [October 25, 2017, 8:48am UTC](https://discourse.julialang.org/t/why-does-similar-sharedarray-create-an-array/6673/3 "2017-10-25T08:48:45Z")

</div>

@fredrikekre Thank you very much for your fast reply.

At least, the behaviour of `similar` seems to be discussed controversially, see also [https://github.com/JuliaLang/julia/issues/22218](https://github.com/JuliaLang/julia/issues/22218). I’m still confused by

```julia
ulia> u0 = SharedArray{Float64}(2,3)
2×3 SharedArray{Float64,2}:
 0.0 0.0 0.0
 0.0 0.0 0.0

julia> copy(u0)
2×3 Array{Float64,2}:
 0.0 0.0 0.0
 0.0 0.0 0.0

julia> deepcopy(u0)
2×3 SharedArray{Float64,2}:
 0.0 0.0 0.0
 0.0 0.0 0.0

```

What is the recommended way to copy a `SharedArray` and get a `SharedArray`? Is it `deepcopy`? Or something like `SharedArray(copy(::SharedArray))`?

---

_[View the full topic](https://discourse.julialang.org/t/why-does-similar-sharedarray-create-an-array/6673)._
