You are not logged in.

#1 2026-02-25 23:08:16

leno_llnx
Member
Registered: 2026-02-25
Posts: 1

New to arch linux - problem with opengl/c++ project -memory leak

Hello community.

Two weeks ago I decied to dive into arch linux.
Goals was to move from windows completely, but got stuck into running one of my projects in c++.

I have this project in c++, opengl project and there I have one unit test that throws error message about memory leak from files libasan.h and libnvidia-glcore.
I searched the internet and got impression that I should get used to this kinda problem with nvidia.
Still I did try couple of things like changing the version of nvidia driver, more specific i am using nvidia-dkms driver.
Changing version did not help. Still got same issue that memory is leaking.


Code is actually very simple. I am just creating window/context, not drawing anything, just simple open and close window



    static void SetUpTestSuite() {
        // Initialize once
        glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 4);
        glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 6);
        glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);
        glfwWindowHint(GLFW_VISIBLE, GLFW_FALSE);
        glfwInitHint(GLFW_PLATFORM, GLFW_PLATFORM_X11);

        if (!glfwInit()) {
            std::cerr << "Failed to initialize GLFW!" << std::endl;
        }
    }

    static void TearDownTestSuite() {
        glfwTerminate();
    }


    void SetUp() override {


        window = glfwCreateWindow(1, 1, "", nullptr, nullptr);
        if (!window) {
            std::cerr << "Failed to create GLFW window!" << std::endl;
        }
        glfwMakeContextCurrent(window);
        int version = gladLoadGL(glfwGetProcAddress);
        std::cout << glGetString(GL_VENDOR) << std::endl;
        std::cout << "OpenGL Version: " << glGetString(GL_VERSION) << "  GLAD version " << version << std::endl;

        GLenum error = glGetError();
        EXPECT_EQ(GL_NO_ERROR, error);
    }
--------------------------------------------------------------------------------------------------------------------------------------------------------------------
Error that I get is this.

==1704==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 5568 byte(s) in 4 object(s) allocated from:
    #0 0x7f07e2b20cb5 in malloc (/usr/lib/libasan.so.8+0x120cb5) (BuildId: 0b96d08695bbce2da9d4770c29ad2e72fb536f47)
    #1 0x7b07dcbf1e31  (/usr/lib/libnvidia-glcore.so.590.48.01+0x9f1e31) (BuildId: 624c9fc17b00e85a78557f9c9b7e4a26f69eb02d)

Direct leak of 184 byte(s) in 1 object(s) allocated from:
    #0 0x7f07e2b205dd in calloc (/usr/lib/libasan.so.8+0x1205dd) (BuildId: 0b96d08695bbce2da9d4770c29ad2e72fb536f47)
    #1 0x7f07e19d1ac3  (/usr/lib/../lib/libdbus-1.so.3+0x24ac3) (BuildId: 65f44f39f68b8f63de82c45fc6108bfc66c0247a)
    #2 0x7f07e19d3bbd in _dbus_message_loader_queue_messages (/usr/lib/../lib/libdbus-1.so.3+0x26bbd) (BuildId: 65f44f39f68b8f63de82c45fc6108bfc66c0247a)
    #3 0x7f07e19de8ae  (/usr/lib/../lib/libdbus-1.so.3+0x318ae) (BuildId: 65f44f39f68b8f63de82c45fc6108bfc66c0247a)
    #4 0x7f07e19deaa7  (/usr/lib/../lib/libdbus-1.so.3+0x31aa7) (BuildId: 65f44f39f68b8f63de82c45fc6108bfc66c0247a)
    #5 0x7f07e19dee00  (/usr/lib/../lib/libdbus-1.so.3+0x31e00) (BuildId: 65f44f39f68b8f63de82c45fc6108bfc66c0247a)
    #6 0x7f07e19df38c  (/usr/lib/../lib/libdbus-1.so.3+0x3238c) (BuildId: 65f44f39f68b8f63de82c45fc6108bfc66c0247a)
    #7 0x7f07e19c2e92  (/usr/lib/../lib/libdbus-1.so.3+0x15e92) (BuildId: 65f44f39f68b8f63de82c45fc6108bfc66c0247a)
    #8 0x7f07e19d7b9f in dbus_pending_call_block (/usr/lib/../lib/libdbus-1.so.3+0x2ab9f) (BuildId: 65f44f39f68b8f63de82c45fc6108bfc66c0247a)
    #9 0x7f07e19c4d46 in dbus_connection_send_with_reply_and_block (/usr/lib/../lib/libdbus-1.so.3+0x17d46) (BuildId: 65f44f39f68b8f63de82c45fc6108bfc66c0247a)
    #10 0x7f07e19c4fed in dbus_bus_register (/usr/lib/../lib/libdbus-1.so.3+0x17fed) (BuildId: 65f44f39f68b8f63de82c45fc6108bfc66c0247a)
    #11 0x7f07e19c52da  (/usr/lib/../lib/libdbus-1.so.3+0x182da) (BuildId: 65f44f39f68b8f63de82c45fc6108bfc66c0247a)
    #12 0x7b07dcc17da6  (/usr/lib/libnvidia-glcore.so.590.48.01+0xa17da6) (BuildId: 624c9fc17b00e85a78557f9c9b7e4a26f69eb02d)


If someone can guide me a little bit, i dont have much knowledge in this area, currently in learning process

Offline

#2 2026-03-21 05:01:48

5hridhyan
Member
From: Asia
Registered: 2025-12-25
Posts: 537

Re: New to arch linux - problem with opengl/c++ project -memory leak

ignore the leaks and run with `ASAN_OPTIONS=detect_leaks=0` or more selectively. If not, create/define smtg like this leak `libnvidia-glcore.so` `leak:libdbus-1.so` and run with  `ASAN_OPTIONS=detect_leaks=1:suppressions=asan.supp`, option3, Disable LSan only (keep ASan)...

Last edited by 5hridhyan (2026-03-21 05:04:17)


---

Offline

Board footer

Powered by FluxBB