# Why Base.summarysize is not exported to Main?

**URL:** <https://discourse.julialang.org/t/why-base-summarysize-is-not-exported-to-main/83367>\
**Category:** General Usage\
**Tags:** question, memory\
**Created:** [June 26, 2022, 7:36pm UTC](https://discourse.julialang.org/t/why-base-summarysize-is-not-exported-to-main/83367 "2022-06-26T19:36:52Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![aerdely](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/aerdely/32/37506_2.png) [@aerdely](https://discourse.julialang.org/u/aerdely)\
**Post date:** [June 26, 2022, 7:36pm UTC](https://discourse.julialang.org/t/why-base-summarysize-is-not-exported-to-main/83367/1 "2022-06-26T19:36:52Z")

</div>

I find more useful `Base.summarysize` than `sizeof` so why `summarysize` is not exported to `Main`?

```julia
v = collect(1:1000);
s = Set(v);
sizeof(v), sizeof(s)
Base.summarysize(v), Base.summarysize(s)
(Base.summarysize(v), Base.summarysize(s)) ./ 1024
varinfo()

```

---

<div class="post-metadata">

**Author:** ![mkitti](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mkitti/32/12459_2.png) [@mkitti](https://discourse.julialang.org/u/mkitti)\
**Post date:** [June 26, 2022, 11:06pm UTC](https://discourse.julialang.org/t/why-base-summarysize-is-not-exported-to-main/83367/2 "2022-06-26T23:06:19Z")

</div>

The other question is why _should_ it be exported from Base?

---

<div class="post-metadata">

**Author:** ![aerdely](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/aerdely/32/37506_2.png) [@aerdely](https://discourse.julialang.org/u/aerdely)\
**Post date:** [June 26, 2022, 11:31pm UTC](https://discourse.julialang.org/t/why-base-summarysize-is-not-exported-to-main/83367/4 "2022-06-26T23:31:08Z")

</div>

I think because it is more informative than `sizeof`.

---

<div class="post-metadata">

**Author:** ![Benny](https://avatars.discourse-cdn.com/v4/letter/b/49beb7/32.png) [@Benny](https://discourse.julialang.org/u/Benny)\
**Post date:** [June 27, 2022, 12:30am UTC](https://discourse.julialang.org/t/why-base-summarysize-is-not-exported-to-main/83367/5 "2022-06-27T00:30:26Z")

</div>

`sizeof` isn’t just a “less informative” version of `summarysize`, they’re intended for different things. If you want to know the memory usage of just a _single_ instance, you need to use `sizeof`. If you want to know the memory footprint of an instance and all the other instances it references, then you need to use `Base.summarysize`. If the primary instance is deallocated, you are guaranteed that at least the `sizeof` number of bytes was freed, but fewer than `Base.summarysize` number of bytes will be freed if some of the referenced instances survived.

Sometimes it gets a bit arbitrary whether a name is exported or not. You don’t want everything documented to get exported because it’ll bloat the namespace. I can see how `sizeof` may have made the cut because it might be useful in more situations, but it doesn’t really mean much that `summarysize` didn’t. Tons of useful things aren’t.
