Hello, I have come across really puzzling (at least for me) output of julia --track-allocation=user. After playing with my code and outputs of benchmarking tools, I have ended up with the following snippet of *.mem file, which shows the main bottleneck in both the memory allocation and speed.
160 values = hcubature([0.,0.,0.,0.,0.],[2*pi,pi,rlimit,2*pi,pi],norm=norm,rtol=rtol,atol=atol,maxevals=10000) do point
45192 l = zero(Int64)
0 integral1,err1 = quadgk(0.,point[3] - singularitybound,rtol=rtolinner,atol=atolinner) do x
34164 l+=1
0 value = one(Float64)
0 value = value
0 helper::Float64 = real(f(a,b,c,d,Z,point[1],point[2],point[3],point[4],point[5],x))
2460372 value *= helper
- # println(typeof(helper))
- # println(typeof(value))
0 helper2::Float64 = real(point[3]^2*sin(point[2])*x^2*sin(point[5]))
2460372 value *= helper2
- # println(typeof(value))
0 value
- end
0 integral2,err2 = quadgk(point[3]+singularitybound,rlimit,rtol=rtolinner,atol=atolinner) do x
480708 l+=1
4363680 value = f(a,b,c,d,Z,point[1],point[2],point[3],point[4],point[5],x)*point[3]^2*sin(point[2])*x^2*sin(point[5])
0 value
- end
366500 println("l: $(l)")
120480 return integral1 + integral2
- end
This code is part of a function and there are no global variables used. f is of type Function and variables a, b, c and d are of type NTuple{3,Int64}. The function f does not allocate anything.
Do you understand why is seems that Julia allocates memory when modifying variables of types Int64 and Float64? This output just doesn’t seem right to me, but I am relatively new to Julia. I am almost sure that there is no type instability.