QCustomPlot Discussion and Comments

customPlot->removePlottable(colormapPointer) Doesn't Free Memory Used By ColormapReturn to overview

Hey,

I just noticed an issue when removing colormaps from my plot. It seems that when I remove a colormap from the plot, the memory usage of my application stays the same.

For example:

If my program is using mb of memory and I create a large colormap, the program then uses 296 mb of memory. If I remove the colormap using:

customPlot->removePlottable(colorMapPointer);

My memory usage either remains at 296 mb of memory, or it is reduced by a small amount like 20 mb. This becomes an issue as I am constantly deleting and creating colormaps, which leads to a lot of memory being used by the program. Does anyone know of a solution to this?

How do you measure memory usage? Valgrind/Memcheck?
The task manager is not a proper way to measure that because the allocator might keep memory for later use associated with the process, until the OS requires more for a different process.

Hey Isso,

I was just using system monitor on Ubuntu to keep track of my memory. Thanks for your suggestion of using Valgrind, I used it's massif tool and was able to find the source of my memory issue. Turns out that a bunch of huge invisible colormaps were being created on another plot due to corner case I wasn't anticipating. Once I fixed that my memory issue cleared right up!