Closed
Description
Version/Branch of Dear ImGui:
Version: 1.72 WIP
Branch: master
Back-end/Renderer/Compiler/OS
Back-ends: imgui_impl_opengl3.cpp
Compiler: llvm
Operating System: VxWorks 7
My Issue/Question:
I'm using the function to add primitives to the draw list for a single window. This renders the gui perfect, but there seems to be a memory leak as after 2 hours of running continuously the system crashes due to the lack of ram.
Here is the code used to initialize build up the screen. Only one window is used as a "canvas" to place all the primitives on. At most there is close to 300 objects that are drawn inside the draw_list.
gfxDisplay disp;
disp.init();
auto [width, height] = disp.getResolution();
auto [eglMajor, eglMinor] = disp.getVersion();
auto[a, b, g, r] = rgba(GetColor(TRANSPARENT));
glClearColorIuiEXT(r, g, b, a);
glEnable(GL_DEPTH);
height = std::max(1, height);
glViewport(0, 0, width, height);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho(-3.0, 3.0, -3.0, 3.0, 1.0, 10000.0);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
const char* glsl_version = "#version 130";
IMGUI_CHECKVERSION();
ImGui::CreateContext();
ImGuiIO& io = ImGui::GetIO();
(void)io;
ImGui::StyleColorsDark();
ImGui_ImplOpenGL3_Init(glsl_version);
while(running)
{
ImGui_ImplOpenGL3_NewFrame();
ImGui_ImplVxWorks_NewFrame();
ImGui::NewFrame();
ImGui::Begin("main", NULL, ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_NoResize |
ImGuiWindowFlags_NoSavedSettings | ImGuiWindowFlags_NoMove |
ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoScrollbar);
draw_list = ImGui::GetWindowDrawList();
/* Call to multiple add functions, Addline, AddBezierCurve, PathArcTo, AddRectFilled, AddRect
andAddText */
draw_list->AddLine(ImVec2(startX-(lineWidth/2), startY-(lineWidth/2)),
ImVec2(endX-(lineWidth/2), endY-(lineWidth/2)),
col,
lineWidth);
ImGui::End();
ImGui::Render();
glClearColor((r / maxRGB), (g / maxRGB), (b / maxRGB), a);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
ImGui_ImplOpenGL3_RenderDrawData(ImGui::GetDrawData());
disp.swapBuffer();
}
ImGui_ImplOpenGL3_Shutdown();
ImGui_ImplVxWorks_Shutdown();
ImGui::DestroyContext();
Hope someone can give some insight!
Metadata
Metadata
Assignees
Labels
No labels