Very basic question: I’m trying to understand why the instantiation of A in the following small example doesn’t appear to produce any allocations in the profiling output:
        - function testfunc()
        0     A = rand(1001,2,3);
        -
    48144     B = zeros(1001,2,3);
        - end
However, if I change the instantiation of A to use zeros instead of rand I get:
        - function testfunc()
    48144     A = zeros(1001,2,3);
        -
    48144     B = zeros(1001,2,3);
        - end
which makes more sense to me.
What is the origin of the difference in these two outputs?
To be clear, I got these results with julia --track-allocation=user and ran
julia> testfunc();
julia> Profile.clear_malloc_data()
julia> testfunc();
to generate these results.
Update Just to add, although the runtimes unsurprisingly differ, both examples report the (identical) expected size of allocation when measured with @btime:
julia> @btime testfunc();
  6.637 μs (4 allocations: 94.03 KiB)
So I’m curious how I can get the output of @btime to be assigned to the “responsible” lines in my code.