Hello !
I am using glfw for an application that needs to stay open for a long time but this application is leaking.
After some research, I saw that the leak was coming from the "glfwSetWindowPos" function.
I made a quick example to illustrate the memory leak:
#include <windows.h>
#include <GLFW/glfw3.h>
#include <cmath>
int CALLBACK WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR pCmdLine, int nCmdShow)
{
int frame = 0;
if (!glfwInit()) exit(-1);
GLFWwindow* window = glfwCreateWindow(500, 500, "Leak", NULL, NULL);
glfwMakeContextCurrent(window);
glfwShowWindow(window);
while (!glfwWindowShouldClose(window))
{
glfwPollEvents();
frame += 1;
glfwSwapBuffers(window);
glfwSetWindowPos(window, std::cos(frame / 100.f) * 50.f, std::sin(frame / 100.f) * 50.f);
}
return 0;
}
After 5 minutes, my application allocated 25MB in RAM. 10 minutes later, 50MB was allocated for the above code example.
I tested directly on a release build (run with .exe).
I ran the application on Windows 11.
Based on Visual Leak Detector, it seems to be a memory allocation (not a memory leak) with std::vector behaviour:
Based on the call stack, AMD driver seems to be the issue of this leak, but I can't investigate more with my current skills:
Here are my driver details:
Is somebody can confirm the issue or have a solution ?