Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-34903

High mysqld.exe RAM consumption after single action in HeidiSQL

Details

    • Bug
    • Status: Open (View Workflow)
    • Major
    • Resolution: Unresolved
    • 11.4.2
    • 11.4
    • Memory management
    • None
    • MariaDB version 11.4.2 on Win64

    Description

      I notice high RAM consumption after single action in HeidiSQL. After startup MariaDB service takes ~380 MB in RAM. Then It keeps same amount of memory for hours. Then I connect to DB using HeidiSQL and click to expand Views branch in tree component.
      I can see command executed displayed:

      SELECT `DEFAULT_COLLATION_NAME` FROM `information_schema`.`SCHEMATA` WHERE `SCHEMA_NAME`='mydb';
      SHOW TABLE STATUS FROM `mydb`;
      SHOW FUNCTION STATUS WHERE `Db`='mydb';
      SHOW PROCEDURE STATUS WHERE `Db`='mydb';
      SHOW TRIGGERS FROM `mydb`;
      SELECT *, EVENT_SCHEMA AS `Db`, EVENT_NAME AS `Name` FROM information_schema.`EVENTS` WHERE `EVENT_SCHEMA`='mydb';
      

      At that point mysqld.exe process takes 2749 MB RAM. Then I disconnect DB in HeidiSQL first and close the program itself. The server process keeps holding 2749 MB RAM.
      Is that normal? How can I investigate memory issues? Can I force to release RAM without restarting service?
      MariaDB version 11.4.2 on Win64.

      Attachments

        Issue Links

          Activity

            1391 MB RAM after idle 50 minutes. This is still 1 GB more than initial state.

            balta Tadas Balaišis added a comment - 1391 MB RAM after idle 50 minutes. This is still 1 GB more than initial state.

            does it grow if you execute this second time?

            wlad Vladislav Vaintroub added a comment - does it grow if you execute this second time?

            Yes.
            It was 976 MB current RAM usage.
            984 MB after login with HeidiSQL.
            And 2365 MB after expanding DB 'Views' branch.

            balta Tadas Balaišis added a comment - Yes. It was 976 MB current RAM usage. 984 MB after login with HeidiSQL. And 2365 MB after expanding DB 'Views' branch.

            information schema queries will open tables, stored routines, etc. All this is cached, so the memory usage must grow, this is expected, to a certain extent.

            Open_table_definitions and Open_tables in SHOW STATUS will tell you the number of entries in the table definition cache and in the table cache.

            Does FLUSH TABLES affect the memory usage?

            It's unlikely that the memory usage will shrink on itself after some time (except inside InnoDB), more likely it'll shrink when, for example, a client disconnects — it frees connection-local caches.

            serg Sergei Golubchik added a comment - information schema queries will open tables, stored routines, etc. All this is cached, so the memory usage must grow, this is expected, to a certain extent. Open_table_definitions and Open_tables in SHOW STATUS will tell you the number of entries in the table definition cache and in the table cache. Does FLUSH TABLES affect the memory usage? It's unlikely that the memory usage will shrink on itself after some time (except inside InnoDB), more likely it'll shrink when, for example, a client disconnects — it frees connection-local caches.

            Flush tables really reduced taken memory from 2.3 GB to 953 MB.
            Duration for 1 query: 00:03:44.2
            InnoDB is being used, yes.

            balta Tadas Balaišis added a comment - Flush tables really reduced taken memory from 2.3 GB to 953 MB. Duration for 1 query: 00:03:44.2 InnoDB is being used, yes.
            wlad Vladislav Vaintroub added a comment - - edited

            There was a similar case, where caches would grown almost uncontrollably, in the past, MDEV-20699

            wlad Vladislav Vaintroub added a comment - - edited There was a similar case, where caches would grown almost uncontrollably, in the past, MDEV-20699

            balta, the tool you can use to analyze a suspected memory leak is UMDH. There is an old writeup for mysqld.exe https://planet.mysql.com/entry/?id=15423 , almost accurate, except download location of Debugging Tools for Windows, which changes every couple of years. And there is a walkthrough by Microsoft https://learn.microsoft.com/en-us/windows-hardware/drivers/debugger/using-umdh-to-find-a-user-mode-memory-leak

            wlad Vladislav Vaintroub added a comment - balta , the tool you can use to analyze a suspected memory leak is UMDH. There is an old writeup for mysqld.exe https://planet.mysql.com/entry/?id=15423 , almost accurate, except download location of Debugging Tools for Windows, which changes every couple of years. And there is a walkthrough by Microsoft https://learn.microsoft.com/en-us/windows-hardware/drivers/debugger/using-umdh-to-find-a-user-mode-memory-leak

            People

              Unassigned Unassigned
              balta Tadas Balaišis
              Votes:
              0 Vote for this issue
              Watchers:
              3 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.