With Julia 1.3, julia --track-allocation=user.
0 lambda = E * nu / (1 + nu) / (1 - 2*(nu));
0 mu = E / 2. / (1+nu);
860578 mI = diagm(0=>[1, 1, 1, 0.5, 0.5, 0.5]);
768 m1m1 = _m1*_m1';
3499241 I3 = [1.0 0 0; 0 1.0 0; 0 0 1.0]
2016 b = [0.0 0 0; 0 0.0 0; 0 0 0.0]
2016 sigma = [0.0 0 0; 0 0.0 0; 0 0 0.0]
6560 return MatDeforNeohookean(mr, mass_density, E, nu, lambda, mu,
- tangentmoduli3d!, update3d!,
- deepcopy(mI), deepcopy(m1m1), deepcopy(I3), deepcopy(b), deepcopy(sigma))
How does one interpret the above? The function with this code is called once.
Where does all the allocation come from?
Edit: I should have mentioned that the measurement is collected during the second run, after clearing the malloc data after the first run.
What is the dimension and size of _m1? Be aware with --track-allocation
sometimes the allocations are not attributed properly so you may get some strange-looking results.
_m1
is a 6-element vector. mI
is a 6 x 6 matrix, and so is m1m1
.
What is strange to me is why the count in this line is so high. I mean, it is the same size of b
below and allocates so much more.
Notice that the function is called once. Not many times.
Even if it was called multiple times, makes no sense for it to have a value different of 2016
, both b
and sigma
have the same size as I3
and they have the same value that is different from I3
. If the function is called one, or a thousand times, the three should have the same value (as they would be created the same number of times, there is no if
).
1 Like
There is no I3
global variable in the code right? No chance that this can be doing something not obvious?
There is some reason for you to create I3
, b
, and sigma
, and then, soon after, pass a deepcopy
of them to the function instead of the originals? I mean, the originals are not being used for anything, why do you need to pass copies of them instead?
No particular reason other than laziness. The code is borrowed from an earlier project.
I just didn’t bother removing the deep copies, since this function is called only once per simulation.
1 Like