epezent / epezent/implot

A memory surge issue

Open
#589 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
6.2k
Forks
693
PR merge metrics
No merged PRs in 30d

Description

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 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 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();
}

```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.