I’m analysing memory usage as described in julia manual , and I found that getproperty functions seem to be related to large numbers.
The following lines is taken from the result .mem file:
- function Base.getproperty(system::System, v::Symbol)
1573581184 if v in [
- :lattice, :k_lattice, :Ω
- ]
0 return getproperty(system.cell, v)
1797157632 elseif v in [
- :elements, :n_atoms, :n_species, :positions, :a2e_inds, :e2a_inds
- ]
0 return getproperty(system.ions, v)
I think getproperty function should not need to allocate memories, so are these numbers only times the
corresponding lines are executed?
A little problem: the answer of @Gnimuc explains the reason and gives a solution, but I finally choose to adopt the tuple way as proposed by @Salmon . Whose answer should I mark as “Solution”?