Memory required for struct array
Ältere Kommentare anzeigen
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
Antworten (1)
Bruno Luong
am 22 Aug. 2023
Bearbeitet: Bruno Luong
am 22 Aug. 2023
4 Kommentare
Bruno Luong
am 22 Aug. 2023
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
am 22 Aug. 2023
Walter Roberson
am 22 Aug. 2023
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.
Kategorien
Mehr zu Structures finden Sie in Hilfe-Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!