# @code\_warntype but for allocations?

**URL:** <https://discourse.julialang.org/t/code-warntype-but-for-allocations/29190>\
**Category:** Performance\
**Created:** [September 26, 2019, 11:13am UTC](https://discourse.julialang.org/t/code-warntype-but-for-allocations/29190 "2019-09-26T11:13:22Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![cshenton](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/cshenton/32/9326_2.png) [@cshenton](https://discourse.julialang.org/u/cshenton)\
**Post date:** [September 26, 2019, 11:13am UTC](https://discourse.julialang.org/t/code-warntype-but-for-allocations/29190/1 "2019-09-26T11:13:22Z")

</div>

Is there a similar macro to `@code_warntype` for allocations? As in, given a function call (or function and tuple of input types), highlights any calls in the function that allocate, just as `code_warntype` highlights sub expressions that are type unstable.

`@time` and `@btime` are fantastic for determining whether code is allocating but not as good for hunting the source down.

If no such macro exists, would people find one useful?

---

<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:** [September 26, 2019, 11:27am UTC](https://discourse.julialang.org/t/code-warntype-but-for-allocations/29190/2 "2019-09-26T11:27:36Z")

</div>

[https://docs.julialang.org/en/v1/manual/profile/#Memory-allocation-analysis-1](https://docs.julialang.org/en/v1/manual/profile/#Memory-allocation-analysis-1)
