# Using TimerOutputs, registers allocs, where @allocated does not?

**URL:** <https://discourse.julialang.org/t/using-timeroutputs-registers-allocs-where-allocated-does-not/111995>\
**Category:** General Usage\
**Created:** [March 22, 2024, 11:00pm UTC](https://discourse.julialang.org/t/using-timeroutputs-registers-allocs-where-allocated-does-not/111995 "2024-03-22T23:00:08Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![Ahmed\_Salih](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ahmed_salih/32/206579_2.png) [@Ahmed\_Salih](https://discourse.julialang.org/u/Ahmed_Salih)\
**Post date:** [March 24, 2024, 11:17am UTC](https://discourse.julialang.org/t/using-timeroutputs-registers-allocs-where-allocated-does-not/111995/3 "2024-03-24T11:17:44Z")

</div>

For future reference, solution here:

> [@Why does sortperm! allocate here?](https://discourse.julialang.org/t/why-does-sortperm-allocate-here/112028):
>
> Hello! I think I am missing something really simple, I just don’t get why allocations occur, when I have preallocated index array. function main() Cartesians = Vector{CartesianIndex{2}}(undef, 100) SortedIndices = collect(LinearIndices(Cartesians)) # Fill the array with random CartesianIndex{2} values for i in 1:100 # Assuming you want indices in the range 1:10 for both dimensions Cartesians[i] = CartesianIndex(rand(1:10), rand(1:10)) end for iter =…

---

_[View the full topic](https://discourse.julialang.org/t/using-timeroutputs-registers-allocs-where-allocated-does-not/111995)._
