Uploaded image for project: 'MariaDB Connector/C'
  1. MariaDB Connector/C
  2. CONC-442

C application memory consumption grows endlessly if the same DB conection has been used for a long time

    XMLWordPrintable

Details

    • Bug
    • Status: Open (View Workflow)
    • Major
    • Resolution: Unresolved
    • 2.3.4, 3.1.7
    • None
    • None
    • None
    • Any

    Description

      In a MariaDB client memory allocation routine:

      gptr alloc_root(MEM_ROOT *mem_root, size_t Size)
      ...
      get_size= MAX(Size+ALIGN_SIZE(sizeof(USED_MEM)),
      (mem_root->block_size & ~1) * (mem_root->block_num >> 2));

      The problem is that if DB connection is open for a long time e.g. weeks, block_num incremented with every alloc_root call an gets quite high and get_size becomes bigger and bigger reaching finally 4GB for 32bit processes causing MariaDB application shutdown.

      Workarounded it by changing alloc_root code to:

      get_size= MAX(Size+ALIGN_SIZE(sizeof(MA_USED_MEM)),
      (mem_root->block_size & ~1) * 1024 );

      Looks working but not sure whether it is a correct solution.

      Attachments

        Activity

          People

            georg Georg Richter
            ykantoni YURII KANTONISTOV
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:

              Git Integration

                Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.