Bug 119591 - macOS: Memory isn't released to the initial state when closing a file after saving
Summary: macOS: Memory isn't released to the initial state when closing a file after s...
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Calc (show other bugs)
Version:
(earliest affected)
6.2.0.0.alpha0+
Hardware: All macOS (All)
: high major
Assignee: Not Assigned
URL:
Whiteboard:
Keywords: perf
Depends on:
Blocks: Memory
  Show dependency treegraph
 
Reported: 2018-08-29 16:00 UTC by Telesto
Modified: 2022-12-21 12:53 UTC (History)
2 users (show)

See Also:
Crash report or crash signature:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Telesto 2018-08-29 16:00:46 UTC
Description:
MacOS: Memory isn't released to the initial state when closing a file after saving 

Steps to Reproduce:
1. Open attachment 144526 [details]
2. Press Save (very slow; lots of comments)
3. Close the document (back to start center)

Actual Results:
Some around 150-250 MB isn't released

Expected Results:
A bigger drop in memory usage when closing the file (back to start center).

And way-off topic a better saving speed: every comment box seems to be rendered through Harfbuzz while saving (does it really have to?)


Reproducible: Always


User Profile Reset: No



Additional Info:
Version: 6.2.0.0.alpha0+
Build ID: 85818da3307a28b2d9c6fa5c1c97ca7833dfe24c
CPU threads: 4; OS: Mac OS X 10.12.6; UI render: default; 
TinderBox: MacOSX-x86_64@49-TDF, Branch:master, Time: 2018-08-22_04:15:46
Locale: nl-NL (nl_NL.UTF-8); Calc: threaded
Comment 1 Alex Thurgood 2018-09-17 08:12:21 UTC
Hmm, my experimentation so far just shows LO consuming more and more memory to the point where my system becomes unresponsive requiring a force kill of the LO process.

I loaded LOdev master into Instruments.app and then followed memory allocations (until both LO and Insruments became unresponsive).

Once the document is loaded, transient memory allocation is running at 10 Gb.
I made a single digit change to one value without a comment in one cell, and then attempted a re-save.

Instruments shows that memory allocation goes through the roof, passing from 10Gb transient to 85Gb transient memory, at which point my whole system becomes unresponsive. Both LO and Instruments grind to a halt.

The memory guzzlers in this seem to be a combination of:

- rtl_UString_new_WithLength : only 1.5kb each, but a gazillion of them 

- rtl_Ustring_ImplAlloc(int) : quite a few of these too at 416 bytes a throw

This block is pointed to in strtmpl.cxx (1139-1157) 

IMPL_RTL_STRINGDATA* IMPL_RTL_STRINGNAME( ImplAlloc )( sal_Int32 nLen )
{
    IMPL_RTL_STRINGDATA * pData
        = (sal::static_int_cast< sal_uInt32 >(nLen)
           <= ((SAL_MAX_UINT32 - sizeof (IMPL_RTL_STRINGDATA))
               / sizeof (IMPL_RTL_STRCODE)))
        ? static_cast<IMPL_RTL_STRINGDATA *>(rtl_allocateString(
            sizeof (IMPL_RTL_STRINGDATA) + nLen * sizeof (IMPL_RTL_STRCODE)))
        : nullptr;




- I also see loads of calls to SfxItemSet::SfxItemSet(SfxItemSet const&), allegedly from itemset.cxx, but a search in itemset.cxx doesn't return any such line...
Comment 2 Xisco Faulí 2018-09-18 17:08:29 UTC
@Tor, I thought you could be interested in this issue...
Comment 3 How can I remove my account? 2019-01-23 22:10:47 UTC
About Telesto's initial description: What you describe isn't necessarily a bug. If the initial state is the Start Centre, it is very normal that after loading a document (for instance, a Writer one) and then closing that document, a lot of persistent data structures and code related to Writer functionality were constructed in and/or loaded into memory. Those don't go away even if you close the only Writer document open.

What would be a problem is if for each time you open the same document (preferably a simple one that doesn't do any weird things like run BASIC macros etc) and close it, the memory consumption increases a lot.

What Alex describes then sounds like a much more serious and different type of problem indeed.
Comment 4 QA Administrators 2021-01-23 04:03:43 UTC
Dear Telesto,

To make sure we're focusing on the bugs that affect our users today, LibreOffice QA is asking bug reporters and confirmers to retest open, confirmed bugs which have not been touched for over a year.

There have been thousands of bug fixes and commits since anyone checked on this bug report. During that time, it's possible that the bug has been fixed, or the details of the problem have changed. We'd really appreciate your help in getting confirmation that the bug is still present.

If you have time, please do the following:

Test to see if the bug is still present with the latest version of LibreOffice from https://www.libreoffice.org/download/

If the bug is present, please leave a comment that includes the information from Help - About LibreOffice.
 
If the bug is NOT present, please set the bug's Status field to RESOLVED-WORKSFORME and leave a comment that includes the information from Help - About LibreOffice.

Please DO NOT

Update the version field
Reply via email (please reply directly on the bug tracker)
Set the bug's Status field to RESOLVED - FIXED (this status has a particular meaning that is not 
appropriate in this case)


If you want to do more to help you can test to see if your issue is a REGRESSION. To do so:
1. Download and install oldest version of LibreOffice (usually 3.3 unless your bug pertains to a feature added after 3.3) from https://downloadarchive.documentfoundation.org/libreoffice/old/

2. Test your bug
3. Leave a comment with your results.
4a. If the bug was present with 3.3 - set version to 'inherited from OOo';
4b. If the bug was not present in 3.3 - add 'regression' to keyword


Feel free to come ask questions or to say hello in our QA chat: https://kiwiirc.com/nextclient/irc.freenode.net/#libreoffice-qa

Thank you for helping us make LibreOffice even better for everyone!

Warm Regards,
QA Team

MassPing-UntouchedBug