Memory required for struct array
Mostrar comentarios más antiguos
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
Respuestas (1)
Bruno Luong
el 22 de Ag. de 2023
Editada: Bruno Luong
el 22 de Ag. de 2023
4 comentarios
Bruno Luong
el 22 de Ag. de 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
el 22 de Ag. de 2023
Walter Roberson
el 22 de Ag. de 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.
Categorías
Más información sobre Structures en Centro de ayuda y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!