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

Memory leak in Cached_item_str::Cached_item_str upon query WITH TIES involving a blob

    XMLWordPrintable

Details

    • Bug
    • Status: Closed (View Workflow)
    • Blocker
    • Resolution: Fixed
    • 10.6
    • 10.6.3
    • Optimizer
    • None

    Description

      CREATE TABLE t (a TEXT);
      INSERT INTO t VALUES ('foo'),('bar');
      SELECT a FROM t ORDER BY a FETCH FIRST 2 ROWS WITH TIES;
       
      # Cleanup
      DROP TABLE t;
      

      10.6 bc04ded235 Valgrind

      Warning: Memory not freed: 1056
      ==1418319== 1,056 bytes in 1 blocks are definitely lost in loss record 1 of 1
      ==1418319==    at 0x483B7F3: malloc (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_memcheck-amd64-linux.so)
      ==1418319==    by 0x173BBED: my_malloc (my_malloc.c:90)
      ==1418319==    by 0xB19A94: Binary_string::real_alloc(unsigned long) (sql_string.cc:44)
      ==1418319==    by 0xC31852: Binary_string::Binary_string(unsigned long) (sql_string.h:391)
      ==1418319==    by 0xC3188C: String::String(unsigned long) (sql_string.h:733)
      ==1418319==    by 0xDFEAAB: Cached_item_str::Cached_item_str(THD*, Item*) (item_buff.cc:76)
      ==1418319==    by 0xDFE8AF: new_Cached_item(THD*, Item*, bool) (item_buff.cc:50)
      ==1418319==    by 0xAC0B24: fill_cached_item_list(THD*, List<Cached_item>*, st_order*, unsigned int) (sql_select.cc:25321)
      ==1418319==    by 0xAC0C09: alloc_order_fields(JOIN*, st_order*, unsigned int) (sql_select.cc:25346)
      ==1418319==    by 0xA84531: JOIN::make_aggr_tables_info() (sql_select.cc:3827)
      ==1418319==    by 0xA81728: JOIN::optimize_stage2() (sql_select.cc:3099)
      ==1418319==    by 0xA7EC8C: JOIN::optimize_inner() (sql_select.cc:2351)
      ==1418319==    by 0xA7C5AC: JOIN::optimize() (sql_select.cc:1694)
      ==1418319==    by 0xA87E85: mysql_select(THD*, TABLE_LIST*, List<Item>&, Item*, unsigned int, st_order*, st_order*, Item*, st_order*, unsigned long long, select_result*, st_select_lex_unit*, st_select_lex*) (sql_select.cc:4840)
      ==1418319==    by 0xA773A0: handle_select(THD*, LEX*, select_result*, unsigned long) (sql_select.cc:446)
      ==1418319==    by 0xA38E09: execute_sqlcom_select(THD*, TABLE_LIST*) (sql_parse.cc:6244)
      

      Without valgrind:

      Warning: Memory not freed: 1056
      Warning: 1056 bytes lost at 0x61a0000270f0, allocated by T@0 at mysys/my_malloc.c:90, sql/sql_string.cc:44, sql/sql_string.h:392, sql/sql_string.h:734, sql/item_buff.cc:76, sql/item_buff.cc:50, sql/sql_select.cc:25321, sql/sql_select.cc:25348
      Warning: 1056 bytes lost at 0x61a0000270f0, allocated by T@0 at mysys/my_malloc.c:90, sql/sql_string.cc:44, sql/sql_string.h:392, sql/sql_string.h:734, sql/item_buff.cc:76, sql/item_buff.cc:50, sql/sql_select.cc:25321, sql/sql_select.cc:25348
      

      No leak with FETCH ... ONLY instead of FETCH ... WITH TIES.

      Attachments

        Issue Links

          Activity

            People

              cvicentiu Vicențiu Ciorbaru
              elenst Elena Stepanova
              Votes:
              0 Vote for this issue
              Watchers:
              2 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.