-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
summarysize is incorrect for small union types #33675
Comments
In fact, for sufficiently large vectors, it's non-deterministic! julia> vec = vcat(missing, ones(100000));
julia> Base.summarysize(vec)
1600048
julia> Base.summarysize(vec)
1462016
julia> Base.summarysize(vec)
1600048
julia> Base.summarysize(vec)
1448096
julia> Base.summarysize(vec)
1600048
julia> Base.summarysize(vec)
1458480 The docstring says it provides a "lower bound", so technically the output might be correct, but that really looks like a bug somewhere. |
The first issue was fixed by #32886 |
The changing result is due to GC --- the value is smaller in trials where GC ran. The summarysize code is pulling out each element and boxing it, then using the addresses to see how many boxes there are. But since those are temporaries, if GC runs they get re-used. But that shouldn't happen since the boxes are unnecessary. I'll fix it. |
(cherry picked from commit 1b6101a)
Can that possibly be right? It seems that it's not counting the extra type bit vector?
The text was updated successfully, but these errors were encountered: