how matlab stores graphics objects?

3 Ansichten (letzte 30 Tage)
Osama Alkurdi
Osama Alkurdi am 27 Feb. 2021
Beantwortet: Steven Lord am 27 Feb. 2021
when i create a figure i noticed that it have alot of propeties and each property hold values,
that means alot of bytes, but the figure size seems to be 8 bytes despite all the properties values which are having a greater size,
my question is if properties values are not stored on (RAM), then where the properties values are stored then, and how matlab calls them that fast if they are really not stored on RAM.
please don't give me links, and thanks in advance
  3 Kommentare
Osama Alkurdi
Osama Alkurdi am 27 Feb. 2021
Bearbeitet: Osama Alkurdi am 27 Feb. 2021
sorry about that, docs have a very elaboration and dont give the point quickly.
Osama Alkurdi
Osama Alkurdi am 27 Feb. 2021
Bearbeitet: Osama Alkurdi am 27 Feb. 2021
give me a link if you have one explains this please.

Melden Sie sich an, um zu kommentieren.

Akzeptierte Antwort

Steven Lord
Steven Lord am 27 Feb. 2021
The Bytes column of the output of whos does not tell the "truth, whole truth, and nothing but the truth" for certain situations.
A = zeros(100);
B = A;
whos A B
Name Size Bytes Class Attributes A 100x100 80000 double B 100x100 80000 double
A and B do not necessarily point to a different block of 80,000 bytes due to the copy-on-write behavior of MATLAB.
f = figure;
whos f
Name Size Bytes Class Attributes f 1x1 8 matlab.ui.Figure
This does not list the full amount of memory required to store all the data and properties associated with a figure window.
Use that data as guidance, not law.
And no, there is no way to get the actual amount of memory associated with f (maybe walking the list of properties in a MEX-file, but again things like copy-on-write would complicate even that.)

Weitere Antworten (2)

Jan
Jan am 27 Feb. 2021
Bearbeitet: Jan am 27 Feb. 2021
This shows, that the displayed "Bytes" in the output of whos does not mean the actually used memory. Note that a variable has an overhead of about 100 Bytes also, so "24 Bytes" for x is not the actual memory consumption also, but only the size of the payload.
  1 Kommentar
Osama Alkurdi
Osama Alkurdi am 27 Feb. 2021
Bearbeitet: Osama Alkurdi am 27 Feb. 2021
thank you but let me ask my question in a simple and different way, how the container(figure) can be less size than the contents (figure properties), that makes no sense.

Melden Sie sich an, um zu kommentieren.


Bruno Luong
Bruno Luong am 27 Feb. 2021
Bearbeitet: Bruno Luong am 27 Feb. 2021
All graphic objects are class "handle". Handles is a identify to designate the object and it's obviously 8 bytes as showed by whos command (ihanle is probaby a pointer or or hashcode, we shoudn't care about the internal meaning).
All the properties and RAM storage are not showed with whos.
Matlab might share RAM for many the data, that happens with object class such as graphical underlined and hierarchical objects.
Details of grahical properties are subjected to change from version to version.

Kategorien

Mehr zu Graphics Object Programming finden Sie in Help Center und File Exchange

Tags

Produkte


Version

R2020a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by