[MDEV-4753] partition_innodb_stmt reports memory leaks from dict/dict0stats_bg.cc:69 Created: 2013-07-04  Updated: 2013-07-04  Resolved: 2013-07-04

Status: Closed
Project: MariaDB Server
Component/s: None
Affects Version/s: 10.0.4
Fix Version/s: None

Type: Bug Priority: Major
Reporter: Sergei Petrunia Assignee: Unassigned
Resolution: Fixed Votes: 0
Labels: None
Environment:

openSUSE 11.3 (x86_64)


Issue Links:
PartOf
is part of MDEV-3932 5.6 merge Closed

 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



 Comments   
Comment by Sergei Petrunia [ 2013-07-04 ]

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()

Comment by Sergei Petrunia [ 2013-07-04 ]

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.

Comment by Sergei Petrunia [ 2013-07-04 ]

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(); }
Comment by Sergei Petrunia [ 2013-07-04 ]

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.

Comment by Sergei Petrunia [ 2013-07-04 ]

Fix pushed into 10.0-monty

Generated at Thu Feb 08 06:58:54 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.