I have a figure containing 20 tabs where each tab contains 4 subplots with 2 line plots on each axes.
Now i want to find out the memory utilized by this figure?

Edit-1:

When i save the figure, its size is only 1.77 MB but when i open it and start switching tabs, memory size start increasing and cosume approx. 2GB

Edit-2:

Figure described above is attached
Regards,
Sugar

 Réponse acceptée

Walter Roberson
Walter Roberson le 26 Juin 2020

1 vote

No method is provided of figuring out how large an object is that is referred to by a graphics handle.
You can get an approximation by using struct() on the handle and checking the size of the struct. However, graphics handles often refer to other graphics objects, and it is not uncommon for graphics objects to indirectly refer to themselves, so you would need some code to recursively descend the object without loops, adding up the sizes as you go.
Such a tool is generally possible; I have had reason to chase through graphics trees myself. But it is a fair bit of work to get right, and Mathworks keeps updating the graphic object representation, so you have to keep updating the code with every new release.

7 commentaires

Sugar Daddy
Sugar Daddy le 26 Juin 2020
Modifié(e) : Sugar Daddy le 26 Juin 2020
if i have 80 axes overall containing 120 lines in a figure
each one of them take more memory than previous one though they are of same size
For example: the first 4-axes took 10MBs and the last 4-axes took ~160 MBs
Walter Roberson
Walter Roberson le 26 Juin 2020
Would you be able to attach an example .fig for me to look at?
Sugar Daddy
Sugar Daddy le 27 Juin 2020
figure is attached.
Walter Roberson
Walter Roberson le 27 Juin 2020
In the test I just did on your figure, the tab groups do not vary more than 450 bytes in size, and the axes do not vary more than 800 bytes in size.
Sugar Daddy
Sugar Daddy le 29 Juin 2020
Please see the attached video in zip file sir
Maybe there's some other issue
Walter Roberson
Walter Roberson le 1 Juil 2020
In the testing I did, the physical memory size did not change much, but the virtual memory size went up. However, the size increase was not associated with visiting the "last" tabs (like 19 and 20), and instead was associated with the number of tabs that had been activated -- if you start at the end and go downwards to the first then the memory also goes up.
My interpretation would be that when you load the fig file, the graphics objects are created, but they are not rendered until they are activated, and that the rendering process consumes memory. The rendered versions are not removed from memory when you switch to a different tab, as you might want to switch back.
Sugar Daddy
Sugar Daddy le 1 Juil 2020
Thanks a lot Sir

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Graphics Performance dans Centre d'aide et File Exchange

Produits

Version

R2020a

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by