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

partition_innodb_stmt reports memory leaks from dict/dict0stats_bg.cc:69

Details

    • Bug
    • Status: Closed (View Workflow)
    • Major
    • Resolution: Fixed
    • 10.0.4
    • None
    • None
    • None
    • openSUSE 11.3 (x86_64)

    Description

      In current 10.0-monty, running

      ./mysql-test-run main.partition_innodb_stmt

      produces this output

      ==============================================================================
       
      TEST                                      RESULT   TIME (ms) or COMMENT
      --------------------------------------------------------------------------
       
      worker[1] Using MTR_BUILD_THREAD 300, with reserved ports 16000..16019
      main.partition_innodb_stmt 'xtradb'      [ pass ]    205
      ***Warnings generated in error logs during shutdown after running tests: main.partition_innodb_stmt
       
      Warning: 1024 bytes lost at 0x2134a50, allocated by T@0 at mysys/my_new.cc:33, ext/new_allocator.h:90, bits/stl_vector.h:140, bits/stl_vector.h:967, bits/vector.tcc:74, dict/dict0stats_bg.cc:69, dict/dict0stats_bg.cc:249, srv/srv0start.cc:2183

      Attachments

        Issue Links

          Activity

            The memory seems to be allocated here:

            void
            dict_stats_recalc_pool_init()
            /=========================/
            {
            ut_ad(!srv_read_only_mode);

            recalc_pool.reserve(RECALC_POOL_INITIAL_SLOTS);
            }

            recalc_pool is defined above as:

            typedef std::vector<table_id_t> recalc_pool_t;
            static recalc_pool_t recalc_pool;

            There is a corresponding deinit function: dict_stats_recalc_pool_deinit()

            psergei Sergei Petrunia added a comment - The memory seems to be allocated here: void dict_stats_recalc_pool_init() / ========================= / { ut_ad(!srv_read_only_mode); recalc_pool.reserve(RECALC_POOL_INITIAL_SLOTS); } recalc_pool is defined above as: typedef std::vector<table_id_t> recalc_pool_t; static recalc_pool_t recalc_pool; There is a corresponding deinit function: dict_stats_recalc_pool_deinit()

            If I put printouts into dict_stats_recalc_pool_init() and dict_stats_recalc_pool_deinit(), the error log shows that _deinit() call is made by the test. Memory leak is still reported.

            psergei Sergei Petrunia added a comment - If I put printouts into dict_stats_recalc_pool_init() and dict_stats_recalc_pool_deinit(), the error log shows that _deinit() call is made by the test. Memory leak is still reported.

            Exploration patch:

            === modified file 'storage/innobase/dict/dict0stats_bg.cc'
            — storage/innobase/dict/dict0stats_bg.cc 2013-03-25 22:03:13 +0000
            +++ storage/innobase/dict/dict0stats_bg.cc 2013-07-04 06:49:06 +0000
            @@ -50,7 +50,22 @@ static const ulint RECALC_POOL_INITIAL_S

            /** The multitude of tables whose stats are to be automatically
            recalculated - an STL vector */
            -typedef std::vector<table_id_t> recalc_pool_t;
            +typedef std::vector<table_id_t> recalc_pool_t_parent;
            +
            +class recalc_pool_t : public recalc_pool_t_parent
            +{
            +public:
            + recalc_pool_t()
            +

            { + fprintf(stderr, "recalc_pool_t ctor\n"); + }

            + ~recalc_pool_t()
            +

            { + fprintf(stderr, "recalc_pool_t dtor\n"); + }

            +
            +};
            +
            static recalc_pool_t recalc_pool;

            typedef recalc_pool_t::iterator recalc_pool_iterator_t;
            @@ -63,6 +78,7 @@ dict_stats_recalc_pool_init()
            /=========================/

            { ut_ad(!srv_read_only_mode); + fprintf(stderr, "dict_stats_recalc_pool_init\n"); recalc_pool.reserve(RECALC_POOL_INITIAL_SLOTS); }

            @@ -76,6 +92,7 @@ dict_stats_recalc_pool_deinit()
            /===========================/

            { ut_ad(!srv_read_only_mode); + fprintf(stderr, "dict_stats_recalc_pool_deinit\n"); recalc_pool.clear(); }
            psergei Sergei Petrunia added a comment - Exploration patch: === modified file 'storage/innobase/dict/dict0stats_bg.cc' — storage/innobase/dict/dict0stats_bg.cc 2013-03-25 22:03:13 +0000 +++ storage/innobase/dict/dict0stats_bg.cc 2013-07-04 06:49:06 +0000 @@ -50,7 +50,22 @@ static const ulint RECALC_POOL_INITIAL_S /** The multitude of tables whose stats are to be automatically recalculated - an STL vector */ -typedef std::vector<table_id_t> recalc_pool_t; +typedef std::vector<table_id_t> recalc_pool_t_parent; + +class recalc_pool_t : public recalc_pool_t_parent +{ +public: + recalc_pool_t() + { + fprintf(stderr, "recalc_pool_t ctor\n"); + } + ~recalc_pool_t() + { + fprintf(stderr, "recalc_pool_t dtor\n"); + } + +}; + static recalc_pool_t recalc_pool; typedef recalc_pool_t::iterator recalc_pool_iterator_t; @@ -63,6 +78,7 @@ dict_stats_recalc_pool_init() / ========================= / { ut_ad(!srv_read_only_mode); + fprintf(stderr, "dict_stats_recalc_pool_init\n"); recalc_pool.reserve(RECALC_POOL_INITIAL_SLOTS); } @@ -76,6 +92,7 @@ dict_stats_recalc_pool_deinit() / =========================== / { ut_ad(!srv_read_only_mode); + fprintf(stderr, "dict_stats_recalc_pool_deinit\n"); recalc_pool.clear(); }

            Running with the exploration patch produces this:

            recalc_pool_t ctor
            ...
            dict_stats_recalc_pool_init
            ...
            dict_stats_recalc_pool_deinit
            ...
            Warning: 1024 bytes lost at 0x2134780, allocated by T@0 at mysys/my_new.cc:33, ext/new_allocator.h:90, bits/stl_vector.h:140, bits/stl_vector.h:967, bits/vector.tcc:74, dict/dict0stats_bg.cc:84, dict/dict0stats_bg.cc:264, srv/srv0start.cc:2183
            Memory lost: 1024 bytes in 1 chunks
            ...
            recalc_pool_t dtor
            ...

            Apparently, the memory is freed in the end, but that happens after the mem leak detector is run.

            psergei Sergei Petrunia added a comment - Running with the exploration patch produces this: recalc_pool_t ctor ... dict_stats_recalc_pool_init ... dict_stats_recalc_pool_deinit ... Warning: 1024 bytes lost at 0x2134780, allocated by T@0 at mysys/my_new.cc:33, ext/new_allocator.h:90, bits/stl_vector.h:140, bits/stl_vector.h:967, bits/vector.tcc:74, dict/dict0stats_bg.cc:84, dict/dict0stats_bg.cc:264, srv/srv0start.cc:2183 Memory lost: 1024 bytes in 1 chunks ... recalc_pool_t dtor ... Apparently, the memory is freed in the end, but that happens after the mem leak detector is run.

            Fix pushed into 10.0-monty

            psergei Sergei Petrunia added a comment - Fix pushed into 10.0-monty

            People

              Unassigned Unassigned
              psergei Sergei Petrunia
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Git Integration

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