QCustomPlot Discussion and Comments

suspected memory leak when re-plotting data Return to overview

I am struggling with a suspected memory leak.
running Qt 5.9.2 Gcc 7.2.0 64bit. on Windows with Msys2 MinGw
QCustomPlot 2.0
I am referencing Processes in windows task manager for my memory increase.
scenario: Ddisplay multiple different scaling on the Y-axis over a common time on my x-axis or when I set the data to have all the save scale on the y-axis. We then move to another set of time. Each time we move to another set of time, my application memory usage increases and never appears to release any memory. If I have zero for all my values there is no increase in memory usage.

below is a snip-it of the code that is drawing my plot.

QCustomPlot *toolingPlot;
QCPAxisRect *mainAxisRect;

if ( !first_plot_tooling_chart_called ) {
delete mainAxisRect;
delete toolingPlot;
toolingPlot = new QCustomPlot( ui->tabMainWindowPlot->currentWidget() );
mainAxisRect = new QCPAxisRect( toolingPlot );
toolingPlot->plotLayout()->addElement( 0, 0, mainAxisRect );

for ( int idx = 0; (idx < itemsToPlotCount); ++idx ) {
mainGraph = toolingPlot->addGraph( mainAxisRect->axis(QCPAxis::atBottom)
, mainAxisRect->axis(QCPAxis::atLeft, idx) );
mainGraph->data()->set( graphDataToPlot[idx], true );

mainGraph->valueAxis()->setRange( YAxisUnitsDisplayLo[idx], YAxisUnitsDisplayHi[idx] );

Problem solved.
was not a memory leak issue. well it was, but not with QCustomPlot. Had a "new char" that I had missed that was filling my vector.