# Total memory size of collections

**URL:** https://discourse.julialang.org/t/total-memory-size-of-collections/89682
**Category:** General Usage
**Created:** [November 3, 2022, 1:34am UTC](https://discourse.julialang.org/t/total-memory-size-of-collections/89682 "2022-11-03T01:34:51Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![hros](https://avatars.discourse-cdn.com/v4/letter/h/97f17d/32.png) [@hros](https://discourse.julialang.org/u/hros)
#### Post date: [November 3, 2022, 1:34am UTC](https://discourse.julialang.org/t/total-memory-size-of-collections/89682/1 "2022-11-03T01:34:52Z")

</div>

how can I get the total memory size of arrays.  
using `sizeof` does not give the total memory footprint.  
for example,

```julia
sizeof([1])==sizeof(["a"])==sizeof(["abcdef"])

```

and

```julia
sizeof([[1,2],[3,4]])==sizeof([[1,2,0],[3,4,0]])

```

Is the data stored contiguously memory? or does it store references to other objecrs?

suppose I want to hash the object; how can I get a starting address (`Ref(x)`?) and total memory size?

---

<div class="post-metadata">

### Author: ![Mason](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mason/32/2423_2.png) [@Mason](https://discourse.julialang.org/u/Mason)
#### Post date: [November 3, 2022, 2:36am UTC](https://discourse.julialang.org/t/total-memory-size-of-collections/89682/2 "2022-11-03T02:36:53Z")

</div>

`Base.summarysize` will do what you want here.
