1
0
Fork 0
mirror of https://github.com/gwm17/implot.git synced 2024-11-26 20:28:50 -05:00

fix memory leak in BenchmarkItem

This commit is contained in:
Evan Pezent 2020-06-12 07:59:17 -05:00
parent 69ba006e97
commit 3a79ff39fc

View File

@ -114,7 +114,7 @@ struct BenchmarkItem {
} }
Col = ImVec4((float)RandomRange(0,1),(float)RandomRange(0,1),(float)RandomRange(0,1),1); Col = ImVec4((float)RandomRange(0,1),(float)RandomRange(0,1),(float)RandomRange(0,1),1);
} }
~BenchmarkItem() { delete Data; } ~BenchmarkItem() { delete[] Data; }
t_float2* Data; t_float2* Data;
ImVec4 Col; ImVec4 Col;
}; };
@ -972,6 +972,7 @@ void ShowDemoWindow(bool* p_open) {
static BenchmarkItem items[n_items]; static BenchmarkItem items[n_items];
ImGui::BulletText("Make sure VSync is disabled."); ImGui::BulletText("Make sure VSync is disabled.");
ImGui::BulletText("%d lines with %d points each @ %.3f FPS.",n_items,1000,ImGui::GetIO().Framerate); ImGui::BulletText("%d lines with %d points each @ %.3f FPS.",n_items,1000,ImGui::GetIO().Framerate);
ImPlot::SetNextPlotLimits(0,1,0,1,ImGuiCond_Always);
if (ImPlot::BeginPlot("##Bench",NULL,NULL,ImVec2(-1,0),ImPlotFlags_Default | ImPlotFlags_NoChild)) { if (ImPlot::BeginPlot("##Bench",NULL,NULL,ImVec2(-1,0),ImPlotFlags_Default | ImPlotFlags_NoChild)) {
char buff[16]; char buff[16];
for (int i = 0; i < 100; ++i) { for (int i = 0; i < 100; ++i) {