Memory required for struct array
显示 更早的评论
it seems to me the numbers derived by Walter are not correct.
In this thread I attempt to fix, mostly by reverse engineering. Note that this are not documented and possibly depend . on the MATLAB version. Currently it's R2023a.
So there is no question explicitly formulated here
回答(1 个)
4 个评论
Bruno Luong
2023-8-22
clear s
s(100).foo = [];
whos s
clear s
s(99).foo = [];
whos s
960 - 952
so the number of extra bytes for each numel() must be 8, not 16.
Bruno Luong
2023-8-22
Walter Roberson
2023-8-22
At the moment, I do not immediately see a difference between your size predictions and my previous enumeration?
My discussion was slightly sloppy in taking about sizes for additional entries, under the assumption that at least one entry was assigned to for each fieldname; it probably would have been better to rewrite them to a base of no entries written to. On the other hand, when no entries at all are allocated to a field, it looks like the 8-bytes-per-element pointer table is not allocated at all.
类别
在 帮助中心 和 File Exchange 中查找有关 Structures 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!