Too much RAM used by TAdvSVGImageCollectionItems

According to the previous topic (Memory leaks on TAdvSVGImageCollection), the problem about memory leaks was fixed but the main problem already exists. The project when runs it takes around 1.5GB, it is the main problem, we need it only takes the size the icons are rendered. In the example that I sent, I had only active 4 icons and an imagelist with around 100 icons. How can it have a size of 1.5gb only running the application? Is there anything we can optimize or you must optimize the code to store a lot of svg icons? Please we need to find a solution to this problem, our application uses more 400 icons.

Hi, somehow the project you send got lost. Could you resend it, I'll investigate where the memory usage is coming from. You can attach it to this post as well, or send it privately to me via a message in this forum.


We have tested the sample, and could not see such a huge load. We have tested this here in release mode.


Is there anything else that we need to do to get such a huge load of memory?

You have to attach madExcept to the application because we need to manage the bug report with that application. I just checked that and it is the real difference in memory and I don´t know why.

Unfortunately we don't have madExcept available here to test with.

We found this here, not sure if it relates.

Maybe, extracting the SVGs out of the form and instead add them to a folder, loading them dynamically to the SVG collection would something worthwile to investigate.

I found there is an option inside madExcept options: Report memory leaks, if I disable this option, then the memory is right, the same than yours. I show you a screenshot from that option.

It is fine, we can release the application disabling only that option, it is only for our own test about memory leaks. However, I realize that the time to start the application is higher when we have the component svg collection, why it requires long time to load 100 icons? Are we doing anything wrong the process to load a lot of icons?

TAdvSVGImageCollection stores the SVG in the form as TPicture data, and upon loading TPicture will load the data as a stream and check which class type represents the data. At this time, we register a special SVG type that is recognized while loading the stream. That's why the form loading is slow, because it needs to load the stream and check the data for SVG for each icon stored in the collection.

Unfortunately that causes a drastic change in the loading time of the application and users might complain about it. We are going to try other ways to try to solve this, but it seems that for now the svg component is not the solution to our DPI problem.

You might want to check which kinds of SVG files you are storing in the TAdvSVGImageCollection. For example, there are at least 2 SVG files of 4 MB, which is the reason for the slow loading.


In fact, if I remove these SVGs:

  • Insertar_Imagen.svg
  • Eliminar_Imagen.svg

Then the application loading is back to normal.