From 188a4db15e34b7fad428608785f5a7013f071080 Mon Sep 17 00:00:00 2001 From: Naravich Chutisilp Date: Mon, 14 Aug 2023 10:18:26 +0200 Subject: [PATCH] UPDATE: remove memory leak warning --- README.md | 35 ----------------------------------- 1 file changed, 35 deletions(-) diff --git a/README.md b/README.md index e6db3a629..46eb41570 100644 --- a/README.md +++ b/README.md @@ -205,38 +205,3 @@ To run the code: ## How to contribute Please have a look at the `contributing.md" file. There you will find all the set of rules and the main softwarer documentation to contribute. - -## 🚧🚧🚧 Memory Leak Issue 🚧🚧🚧 -We notice the memory leak caused by TTool integration. -### Cause -- TTool uses Qt5's View to render the track the toolheads. -- AC uses glfw to show window UI. -- Thus, context switching between TTool and AC is required in order for OpenGL to render to the correct buffers. -#### Context Switching -- In order to do the context switching between AC and TTool, we introduced `TTool::MakeCurrent()` and `TTool::ReleaseCurrent()` on TTool. -- We also introduct `Window::MakeCurrent()` and `Window::ReleaseCurrent()` on Window. -- Now, one context needs to be released, before the other can make current. -#### Issues/Behaviours -- We found that the MakeCurrent and ReleaseCurrent cannot be called carelessly. -- In the `Application::Run()`, this make and release will be called repeatedly, which leads to additional memory increase on the program which will not decrease. -#### Replication -- Run this program on this commit, and monitor the memory increase. -- To replicate the worse memory leak rate that we discovered, please change from this commit (d876108cd9cff82dd72c2a1d8be1306c7db3b19a) -```cpp -// Application.cpp - -void Application::Run() -{ - // ... code before ... - m_Window->MakeCurrent(); // ADD THIS LINE - - GetLayer()->OnUIRender(); - - m_Window->ReleaseCurrent(); // ADD THIS LINE - // ... code after ... - } -} -``` -#### Mitigation -- We put the context switching only on the TTool `OnAttach` and `OnFrameStart`. -- In this current commit (d876108cd9cff82dd72c2a1d8be1306c7db3b19a), we found the most bearable memory increase rate, that will allow the program to run for some hours on 10GB memory device.