# Memory Allocation Analysis - Memory assigned on comment lines

**URL:** <https://discourse.julialang.org/t/memory-allocation-analysis-memory-assigned-on-comment-lines/1125>\
**Category:** General Usage\
**Created:** [December 23, 2016, 10:53pm UTC](https://discourse.julialang.org/t/memory-allocation-analysis-memory-assigned-on-comment-lines/1125 "2016-12-23T22:53:12Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jason\_McConochie](https://avatars.discourse-cdn.com/v4/letter/j/b2d939/32.png) [@Jason\_McConochie](https://discourse.julialang.org/u/Jason_McConochie)\
**Post date:** [December 23, 2016, 10:53pm UTC](https://discourse.julialang.org/t/memory-allocation-analysis-memory-assigned-on-comment-lines/1125/1 "2016-12-23T22:53:12Z")

</div>

I’m running a function in a module and running a user memory allocation analysis. An extract from the function .mem file shows apparently memory allocation on commented lines. What does this mean?

```julia
        - # end
        0 # o.ilcrest=find(ra1 | ra2)+1
  1600608 #
        - # # I3.1 Find all 212 style troughs
        - # for i=1:nz-2
        - # ra1[i]=(z[i]>z[i+1]) & (z[i+1]<z[i+2])
        - # end
        - # # I3.2 Find all 2112 style crests
        - # for i=1:nz-3
        - # ra2[i]=(z[i]>z[i+1]) & (z[i+1]==z[i+2]) & (z[i+2]<z[i+3])
        - # end
        - # o.iltrough=find(ra1 | ra2)+1
        - #
        - # # J. Categorise slope
        - # o.ipslope=falses(nz)
        - # o.i0slope=falses(nz)
        - # o.inslope=falses(nz)
        0 # for i=1:nz-2
   800288 # # .. find all points with neutral gradient
        0 # o.ipslope[i]=z[i] < z[i+1]
   813168 # # .. find all points with neutral gradient
        - # o.i0slope[i]=z[i] == z[i+1]
        - # # .. find all points with negative gradient
        - # o.inslope[i]=z[i] > z[i+1]
        - # end
        - #

```

---

<div class="post-metadata">

**Author:** ![evanfields](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/evanfields/32/1744_2.png) [@evanfields](https://discourse.julialang.org/u/evanfields)\
**Post date:** [December 26, 2016, 11:24pm UTC](https://discourse.julialang.org/t/memory-allocation-analysis-memory-assigned-on-comment-lines/1125/2 "2016-12-26T23:24:18Z")

</div>

Sorry, not your answer, but - what tool are you using to get the line-level memory allocation annotations?

---

<div class="post-metadata">

**Author:** ![dpsanders](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/dpsanders/32/3573_2.png) [@dpsanders](https://discourse.julialang.org/u/dpsanders)\
**Post date:** [December 27, 2016, 12:42am UTC](https://discourse.julialang.org/t/memory-allocation-analysis-memory-assigned-on-comment-lines/1125/3 "2016-12-27T00:42:49Z")

</div>

The second bullet point in [http://docs.julialang.org/en/release-0.5/manual/performance-tips/#tools](http://docs.julialang.org/en/release-0.5/manual/performance-tips/#tools)

---

<div class="post-metadata">

**Author:** ![dpsanders](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/dpsanders/32/3573_2.png) [@dpsanders](https://discourse.julialang.org/u/dpsanders)\
**Post date:** [December 27, 2016, 12:43am UTC](https://discourse.julialang.org/t/memory-allocation-analysis-memory-assigned-on-comment-lines/1125/4 "2016-12-27T00:43:32Z")

</div>

Which Julia version is this with? I seem to remember this had been reported fixed, maybe in 0.6-dev (still in alpha).

---

<div class="post-metadata">

**Author:** ![vchuravy](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/vchuravy/32/8_2.png) [@vchuravy](https://discourse.julialang.org/u/vchuravy)\
**Post date:** [December 27, 2016, 2:06am UTC](https://discourse.julialang.org/t/memory-allocation-analysis-memory-assigned-on-comment-lines/1125/5 "2016-12-27T02:06:04Z")

</div>

There have been fixes for this in `v0.6`, if this is on `v0.5` turning off inlining might help `julia --inline=no`.

---

<div class="post-metadata">

**Author:** ![Jason\_McConochie](https://avatars.discourse-cdn.com/v4/letter/j/b2d939/32.png) [@Jason\_McConochie](https://discourse.julialang.org/u/Jason_McConochie)\
**Post date:** [December 27, 2016, 8:21am UTC](https://discourse.julialang.org/t/memory-allocation-analysis-memory-assigned-on-comment-lines/1125/6 "2016-12-27T08:21:15Z")

</div>

I’ve been using v0.5. Applying --inline=no has fixed the problem, now the allocations look more sensible and no longer on comment lines. Thank you all.
