Stream: helpdesk (published)

Topic: ✔ How to find size of an object in bytes?


view this post on Zulip Júlio Hoffimann (Feb 15 2024 at 12:36):

The sizeof function from Base returns the size of the "pointers" apparently, it doesn't account for the buffer size:

julia> struct A{V}
         a::V
       end

julia> a = A(rand(10000))
A{Vector{Float64}}([0.8986201930614641, 0.4380709243355351, 0.00045792138769884527, 0.5289490273804567, 0.6269368643057421, 0.20649195243751506, 0.07710997000926856, 0.536498794232181, 0.4267722308408214, 0.9107359146688295    0.18391510235668862, 0.3585581170771124, 0.5766750582775166, 0.97806775515992, 0.8836059221020682, 0.08132306098743225, 0.7069638671825478, 0.5282713222766646, 0.42890603564883734, 0.5912185651454117])

julia> sizeof(a)
8

view this post on Zulip Júlio Hoffimann (Feb 15 2024 at 12:40):

We are developing an application with very large 3D models of the subsurface, and Julia is crashing with 32Gb of RAM. We are trying to pin-point the objects that are consuming most of the memory, and suspect that they cannot eat 32Gb of memory alone. Is the Julia runtime too heavy memory-wise?

view this post on Zulip Júlio Hoffimann (Feb 15 2024 at 12:42):

(Julia v1.10.0)

view this post on Zulip Jakob Nybo Nissen (Feb 15 2024 at 13:09):

Base.summarysize

view this post on Zulip Júlio Hoffimann (Feb 15 2024 at 13:10):

Thank you @Jakob Nybo Nissen !

view this post on Zulip Notification Bot (Feb 15 2024 at 13:10):

Júlio Hoffimann has marked this topic as resolved.


Last updated: Nov 22 2024 at 04:41 UTC