Hello,
I wrote a simple function recursively and when testing it I found that it allocates a lot of memory.
julia> @time brute_force(10,63)
[...]
32.055675 seconds (392.13 M allocations: 8.765 GiB, 28.16% gc time)
I thought this probably was due to all those function calls, so I wrote the same, but iteratively, and to my surprise the allocated memory was even larger:
julia> @time brute_force_it(10,63)
41.741401 seconds (522.84 M allocations: 11.686 GiB, 29.09% gc time)
I have some possible candidates for these allocations, but since I don’t know exactly what triggers memory allocation in Julia, I want to avoid guessing and would like to profile the code for allocations. What is the recommended way to get this information?
(If I write this iterative code in Fortran/C I know that the memory allocations would be minimal, so I want to understand what Julia is doing)
Many thanks,
AdV