-
-
Notifications
You must be signed in to change notification settings - Fork 5.7k
Open
Labels
docsThis change adds or pertains to documentationThis change adds or pertains to documentation
Description
From the docstring, for non DataType values,
the size, in bytes, of object
obj
There are multiple ways of measuring size:
sizeof ∘ typeof returns the immediate size of an object (i.e. how many bytes it takes up)
Base.summarysize returns the total amount of referenced memory by an object.
sizeof(x) seems a little different & more domain/semantic specific. The default is Core.sizeof, which is not documented but appears to be sizeof ∘ typeof.
Some examples
julia> sizeof(falses(100))
16
julia> sizeof(fill(false, 100))
100
julia> sizeof("abc")
3
julia> sizeof("aβc")
4
julia> sizeof(['a', 'b', 'c'])
12
julia> sizeof(view(['a', 'b', 'c'], 1:2))
8
julia> sizeof(SubString("aβc", 2))
3I'd like the answer to this question to appear in help?> sizeof.
pfitzseb, nandoconde and xlxs4
Metadata
Metadata
Assignees
Labels
docsThis change adds or pertains to documentationThis change adds or pertains to documentation