# What's in the .mem files?

**URL:** <https://discourse.julialang.org/t/whats-in-the-mem-files/20592>\
**Category:** Performance\
**Created:** [February 8, 2019, 6:04pm UTC](https://discourse.julialang.org/t/whats-in-the-mem-files/20592 "2019-02-08T18:04:06Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![tanhevg](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tanhevg/32/12025_2.png) [@tanhevg](https://discourse.julialang.org/u/tanhevg)\
**Post date:** [February 8, 2019, 6:04pm UTC](https://discourse.julialang.org/t/whats-in-the-mem-files/20592/1 "2019-02-08T18:04:06Z")

</div>

Hello,

I have run julia with `--track-allocation=all`, and it has generated a bunch of .mem files for my code. Some of my lines are annotated with numbers on the left hand side. What exactly do those numbers mean? Are they somehow related to the output of `@time` macro (which also reports allocations)?

Specifically, I am puzzled with the following. Apparently, I have allocated 3200 of something by just adding two floating point numbers, and 1600 more by storing a max of two other numbers. Both of these occur in a loop.

```julia
3200 d0 = prev_d[j - 1] + score
1600 d = max(d0, d)

```

Some of my lines where I am pretty certain that I am allocating memory don’t have numbers on the left hand side. Should this be reported as a bug?

```julia
- ret = AlignmentContext{AT}(n, m) # this allocates an n x m array

```

I run Julia 1.0.3 on Linux.

Should I be using a more reliable method of tracking memory allocation?

---

<div class="post-metadata">

**Author:** ![bennedich](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/bennedich/32/4894_2.png) [@bennedich](https://discourse.julialang.org/u/bennedich)\
**Post date:** [February 8, 2019, 9:19pm UTC](https://discourse.julialang.org/t/whats-in-the-mem-files/20592/2 "2019-02-08T21:19:02Z")

</div>

It’s supposed to be the number of bytes allocated on that line, but unfortunately it’s not super accurate, and often misses allocations. [I wrote a bit about it in this post](https://discourse.julialang.org/t/help-to-reduce-number-of-allocations/19308/17).

As for memory allocated where you think there shouldn’t be: You can verify with `@time` that memory is indeed allocated there (just put `@time` in front of those lines).

Unexpected allocations are often caused by type instability. Run `@code_warntype` for your function and look for any instabilities (i.e. “::Any” colored in red).
