Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • D dbus
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 262
    • Issues 262
    • List
    • Boards
    • Service Desk
    • Milestones
  • Custom issue tracker
    • Custom issue tracker
  • Merge requests 34
    • Merge requests 34
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Container Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • dbusdbus
  • dbus
  • Issues
  • #336
Closed
Open
Issue created Jun 11, 2021 by Plan C@hubenchang0515

private connection seems always cause a memory leak

run this demo:

#include <stdio.h>
#include <unistd.h>
#include <dbus/dbus.h>

void test()
{
    DBusConnection *dbus_conn = dbus_bus_get_private(DBUS_BUS_SESSION, NULL);
    dbus_connection_close(dbus_conn);
    dbus_connection_unref(dbus_conn);
}

int main()
{
    int nIndex = 0;
    while(TRUE)
    {
        printf("Test %d times\n", ++nIndex);
        test();
        usleep(100);
    }
    return 0;
}

see the top:

top - 16:27:40 up  2:04,  1 user,  load average: 1.72, 3.41, 3.39
Tasks:   1 total,   0 running,   1 sleeping,   0 stopped,   0 zombie
%Cpu(s):  6.5 us,  0.0 sy,  0.0 ni, 93.5 id,  0.0 wa,  0.0 hi,  0.0 si,  0.0 st
MiB Mem :   3856.0 total,    153.3 free,   2783.6 used,    919.0 buff/cache
MiB Swap:   8192.0 total,   5774.2 free,   2417.8 used.    449.3 avail Mem 

  PID USER      PR  NI    VIRT    RES    SHR S  %CPU  %MEM     TIME+ COMMAND                                  
 4421 planc     20   0  409464 257764   2008 S   0.0   6.5   9:50.96 dbus-daemon                              

RES of dbus-daemon will increase continuously, then exit the demo, the RES will not reduce.

Assignee
Assign to
Time tracking