# \`@allocated\` vs \`@allocations\`

**URL:** <https://discourse.julialang.org/t/allocated-vs-allocations/134408>\
**Category:** Performance\
**Tags:** question, allocations\
**Created:** [December 7, 2025, 7:20am UTC](https://discourse.julialang.org/t/allocated-vs-allocations/134408 "2025-12-07T07:20:51Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Tamas\_Papp](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tamas_papp/32/25949_2.png) [@Tamas\_Papp](https://discourse.julialang.org/u/Tamas_Papp)\
**Post date:** [December 7, 2025, 7:20am UTC](https://discourse.julialang.org/t/allocated-vs-allocations/134408/1 "2025-12-07T07:20:51Z")

</div>

Since 1.9, Julia has [`@allocations`](https://docs.julialang.org/en/v1/base/base/#Base.@allocations), which is

> A macro to evaluate an expression, discard the resulting value, and instead return the total number of allocations during evaluation of the expression.

In contrast, `@allocated` is

> A macro to evaluate an expression, discarding the resulting value, instead returning the total number of bytes allocated during evaluation of the expression.

Is there a difference? When should we use which?

---

<div class="post-metadata">

**Author:** ![baggepinnen](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/baggepinnen/32/693_2.png) [@baggepinnen](https://discourse.julialang.org/u/baggepinnen)\
**Post date:** [December 7, 2025, 8:04am UTC](https://discourse.julialang.org/t/allocated-vs-allocations/134408/2 "2025-12-07T08:04:41Z")

</div>

One returns a count, the other a “volume” in bytes.

To profile anything but very small functions, I usually use the memory profiler instead. This tells you were and how much memory is allocated by your program.

---

<div class="post-metadata">

**Author:** ![Tamas\_Papp](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tamas_papp/32/25949_2.png) [@Tamas\_Papp](https://discourse.julialang.org/u/Tamas_Papp)\
**Post date:** [December 7, 2025, 8:36am UTC](https://discourse.julialang.org/t/allocated-vs-allocations/134408/3 "2025-12-07T08:36:06Z")

</div>

Thanks, my eyes missed that one word of difference.
