Memory Allocation Analysis - Memory assigned on comment lines


#1

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?

        - #  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
        - #

#2

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


#3

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


#4

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


#5

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


#6

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.