# What does sizeof return for wrappers of arrays?

**URL:** <https://discourse.julialang.org/t/what-does-sizeof-return-for-wrappers-of-arrays/43237>\
**Category:** General Usage\
**Tags:** question\
**Created:** [July 17, 2020, 12:57pm UTC](https://discourse.julialang.org/t/what-does-sizeof-return-for-wrappers-of-arrays/43237 "2020-07-17T12:57:37Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![jishnub](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jishnub/32/33620_2.png) [@jishnub](https://discourse.julialang.org/u/jishnub)\
**Post date:** [July 17, 2020, 12:57pm UTC](https://discourse.julialang.org/t/what-does-sizeof-return-for-wrappers-of-arrays/43237/1 "2020-07-17T12:57:37Z")

</div>

Eg:

```julia
julia> a = ones(10);

julia> sizeof(a)
80

julia> sizeof(a')
8

julia> a = ones(ComplexF64, 10);

julia> sizeof(a')
8

```

I’m not sure how to interpret the results for the adjoint? Similar issues arise for `OffsetArray`s and other wrappers. It appears that `SubArray`s have the method defined:

```julia
julia> a = ones(10);

julia> sizeof(@view a[:])
80

```

Is this a case of missing methods for other wrappers?

---

<div class="post-metadata">

**Author:** ![mbauman](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mbauman/32/31082_2.png) [@mbauman](https://discourse.julialang.org/u/mbauman)\
**Post date:** [July 17, 2020, 3:21pm UTC](https://discourse.julialang.org/t/what-does-sizeof-return-for-wrappers-of-arrays/43237/2 "2020-07-17T15:21:39Z")

</div>

Hunh, here I was actually surprised at the `SubArray` result! We don’t really have the surrounding architecture to meaningfully use `sizeof`’s results, and it probably doesn’t mean what you’re actually trying to understand. I’d guess you actually want something more akin to `Base.summarysize` instead.

You’re right, though, we should probably implement `sizeof` for those wrappers to just defer to their wrapped array (or just generally do better here). Thanks for bringing this up! See: [#36714](https://github.com/JuliaLang/julia/issues/36714) and [#36715](https://github.com/JuliaLang/julia/issues/36715).
