Bug 114469 - SfxItemSet::InitRanges_Impl(unsigned short const*) leaks memory with multiple invocations
Summary: SfxItemSet::InitRanges_Impl(unsigned short const*) leaks memory with multiple...
Status: RESOLVED INSUFFICIENTDATA
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
6.1.0.0.alpha0+
Hardware: All macOS (All)
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: Memory
  Show dependency treegraph
 
Reported: 2017-12-14 15:07 UTC by Telesto
Modified: 2023-01-19 03:25 UTC (History)
3 users (show)

See Also:
Crash report or crash signature:


Attachments
Screenshot (427.92 KB, image/png)
2017-12-14 15:08 UTC, Telesto
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Telesto 2017-12-14 15:07:14 UTC
Description:
SfxItemSet::InitRanges_Impl(unsigned short const*) leaks memory with multiple invocations

Steps to Reproduce:
1. Start the Instruments
2. Choose Memory Leak profile tool
3. Select LibreOffice.app in instdir as target process
4. Click on the record button, LODev is started by the profiling tool
5. Wait for the StartCenter to load.
6. Click on the new Writer document icon to open a blank Writer document.
7. Tools -> Autotext
8. Select Standard -> Lorem ipsum
9. Press Insert -> Leak

Actual Results:  
Leak when inserting autotext

Expected Results:
No leak


Reproducible: Always


User Profile Reset: No



Additional Info:
Version: 6.1.0.0.alpha0+
Build ID: d46dc8e547810208287aab77f0313f1971901464
CPU threads: 4; OS: Mac OS X 10.12.6; UI render: default; 
TinderBox: MacOSX-x86_64@49-TDF, Branch:master, Time: 2017-12-08_10:35:46
Locale: nl-NL (nl_NL.UTF-8); Calc: group threaded


User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_6) AppleWebKit/603.3.8 (KHTML, like Gecko) Version/10.1.2 Safari/603.3.8
Comment 1 Telesto 2017-12-14 15:08:56 UTC
Created attachment 138448 [details]
Screenshot
Comment 2 Julien Nabet 2017-12-19 20:06:02 UTC
Sorry I didn't find the root cause, I'll uncc then.
Comment 3 Alex Thurgood 2018-01-11 13:29:12 UTC
Confirming on my latest master build of 10/01/2018

The code involved pointed to by Instruments.app, is the following :

void SfxItemSet::InitRanges_Impl(const sal_uInt16 *pWhichPairTable)
{
    sal_uInt16 nCnt = 0;
    const sal_uInt16* pPtr = pWhichPairTable;
    while( *pPtr )
    {
        nCnt += ( *(pPtr+1) - *pPtr ) + 1;
        pPtr += 2;
    }

    m_pItems = new const SfxPoolItem*[nCnt]{};

    std::ptrdiff_t cnt = pPtr - pWhichPairTable +1;
    m_pWhichRanges = new sal_uInt16[ cnt ];
    memcpy( m_pWhichRanges, pWhichPairTable, sizeof( sal_uInt16 ) * cnt );
}

at lines 104-119 of itemset.cxx
Comment 4 Alex Thurgood 2018-01-11 13:31:32 UTC
In particular, the lines:

    m_pItems = new const SfxPoolItem*[nCnt]{};


and:

    m_pWhichRanges = new sal_uInt16[ cnt ];

are pointed to by the Instruments tool.
Comment 5 QA Administrators 2021-01-11 03:55:25 UTC Comment hidden (obsolete)
Comment 6 Julien Nabet 2021-11-21 20:35:01 UTC
Just taking a look at mem leaks bugtrackers, SfxItemSet::InitRanges_Impl doesn't exist anymore.

git history of svl/source/items/itemset.cxx shows lots of evols (see https://opengrok.libreoffice.org/history/core/svl/source/items/itemset.cxx).
Any better with recent LO version?
Comment 7 QA Administrators 2022-05-21 03:39:52 UTC Comment hidden (obsolete)
Comment 8 QA Administrators 2022-06-21 03:30:19 UTC Comment hidden (obsolete)
Comment 9 QA Administrators 2022-12-19 03:18:33 UTC Comment hidden (obsolete)
Comment 10 QA Administrators 2023-01-19 03:25:01 UTC
Dear Telesto,

Please read this message in its entirety before proceeding.

Your bug report is being closed as INSUFFICIENTDATA due to inactivity and
a lack of information which is needed in order to accurately
reproduce and confirm the problem. We encourage you to retest
your bug against the latest release. If the issue is still
present in the latest stable release, we need the following
information (please ignore any that you've already provided):

a) Provide details of your system including your operating
   system and the latest version of LibreOffice that you have
   confirmed the bug to be present

b) Provide easy to reproduce steps – the simpler the better

c) Provide any test case(s) which will help us confirm the problem

d) Provide screenshots of the problem if you think it might help

e) Read all comments and provide any requested information

Once all of this is done, please set the bug back to UNCONFIRMED
and we will attempt to reproduce the issue. Please do not:

a) respond via email 

b) update the version field in the bug or any of the other details
   on the top section of our bug tracker

Warm Regards,
QA Team

MassPing-NeedInfo-FollowUp