Skip to content

A memory surge issue #589

@zhubo1126

Description

@zhubo1126

I'm not sure if this is a known issue, when I use ImPlot:: PlotLine to plot 80000 static points and display them all, for example:

				static std::vector<float> plot_y(80000, 0);
				if (ImPlot::BeginPlot(u8"test_plot1", u8"index", u8"val", ImVec2(-1, -1), ImPlotFlags_NoLegend | ImPlotFlags_NoTitle | ImPlotFlags_NoMouseText))
				{
					ImPlot::SetupAxis(ImAxis_Y1, u8"val", ImPlotAxisFlags_AutoFit);
					ImPlot::SetupAxisLimits(ImAxis_X1, 0, 80000, ImGuiCond_Always);
					ImPlot::PlotLine("plot2", plot_y.data(), 80000);
					ImPlot::EndPlot();
				}

The memory usage only increased by 25MB, which is basically normal. But when switching to dynamically drawing 80000 points, the memory usage will increase by more than 1000 MB, for example:

				static std::vector<float> plot_y(80000, 0);
				static int plot_show_points = 0;
				plot_show_points += 200;
				if (plot_show_points > 80000)
					plot_show_points = 0;
				if (ImPlot::BeginPlot(u8"test_plot1", u8"index", u8"val", ImVec2(-1, -1), ImPlotFlags_NoLegend | ImPlotFlags_NoTitle | ImPlotFlags_NoMouseText))
				{
					ImPlot::SetupAxis(ImAxis_Y1, u8"val", ImPlotAxisFlags_AutoFit);
					ImPlot::SetupAxisLimits(ImAxis_X1, 0, plot_points, ImGuiCond_Always);
					ImPlot::PlotLine("plot2", plot_y.data(), plot_show_points);
					ImPlot::EndPlot();
				}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions