Bug 106617 - Writer memory leak
Summary: Writer memory leak
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
(earliest affected) release
Hardware: All All
: medium normal
Assignee: Not Assigned
Keywords: bibisectRequest, perf, regression
Depends on:
Blocks: Memory
  Show dependency treegraph
Reported: 2017-03-18 07:36 UTC by dusk@gotadsl.co.uk
Modified: 2019-01-11 13:15 UTC (History)
4 users (show)

See Also:
Crash report or crash signature:

Sample File (144.35 KB, application/vnd.oasis.opendocument.text)
2017-06-13 18:01 UTC, Telesto

Note You need to log in before you can comment on or make changes to this bug.
Description dusk@gotadsl.co.uk 2017-03-18 07:36:25 UTC
Within a few 'saves' of large Writer files, LO 5.3 memory use increases from ~200Mb up to 10Gb and necessitates repeated closing of LO. This has been a problem throughout use of LO 5+.
Comment 1 Xisco Faulí 2017-03-18 13:08:55 UTC

it seems you're using an old version of LibreOffice.
Could you please try to reproduce it with the latest version of LibreOffice from https://www.libreoffice.org/download/libreoffice-fresh/ ?
I have set the bug's status to 'NEEDINFO'. Please change it back to 'UNCONFIRMED' if the bug is still present in the latest version.
Comment 2 dusk@gotadsl.co.uk 2017-03-20 13:15:49 UTC
There's definitely still a memory leak with 5.3.1. Each time I save the RAM grabbed by writer goes up. Also, I've noticed with recent versions that if I save, when there's nothing new to save, unlike older versions, it fails to spot this and still goes through the exercise of saving (and grabbing more RAM).
Comment 3 Xisco Faulí 2017-03-20 16:12:59 UTC

Thank you for reporting the bug. Please attach a sample document, as this makes it easier for us to verify the bug. 
I have set the bug's status to 'NEEDINFO'. Please change it back to 'UNCONFIRMED' once the requested document is provided.
(Please note that the attachment will be public, remove any sensitive information before attaching it. 
See https://wiki.documentfoundation.org/QA/FAQ#How_can_I_eliminate_confidential_data_from_a_sample_document.3F for help on how to do so.)
Comment 4 dusk@gotadsl.co.uk 2017-03-20 17:29:18 UTC
I'm afraid it's not possible to remove confidential data; there's too much of it. However, are you saying that the leak is not systemic to LO? ie. it may be specific to my particular file? I've certainly found this happening with other large files. It is possible it happens with smaller ones but I guess it would happen at a slower rate so not be noticed before the next reboot.
Comment 5 Xisco Faulí 2017-03-20 17:34:09 UTC
If you're certain it happens with other large files, please attach one of those files which doesn't contain confidential data, otherwise, it's impossible for us to triage this issue.
Comment 6 Telesto 2017-06-13 18:01:04 UTC Comment hidden (obsolete)
Comment 7 Patrick Mullaney 2017-06-14 16:21:38 UTC
Was able to repro.  Went through recommended steps, closed, reopened, and repeated processes 3 times, initial memory when from about 238mb up to around 500mb.  Performance was noticeably slower with each iteration to reproduce steps as well.

Repro on:
Build ID: 3d9a8b4b4e538a85e0782bd6c2d430bafe583448
CPU Threads: 4; OS Version: Mac OS X 10.11.6; UI Render: default; Layout Engine: new; 
Locale: en-US (en.UTF-8); Calc: group
Comment 8 dusk@gotadsl.co.uk 2017-06-15 17:53:49 UTC
Yes, that sounds about right. And it's definitely a case of the LO being used, rather than the file simply being opened that takes the memory. Eg. I've just opened an 'offending file' and LO is using 175Mb, up from 54Mb when no file opened. However, if I start editing, will quickly rise to 1Gb and a 2nd file of similar size would go over 1.5Gb.

I have also noticed that Writer takes considerable time just to react after moving to it from another application. Presumably it is having to grab RAM from other applications?
Comment 9 Telesto 2017-06-18 07:01:50 UTC
Repro with Version

but not with
Build ID: 8a35821d8636a03b8bf4e15b48f59794652c68b
Comment 10 Telesto 2017-09-30 19:44:56 UTC
Also a repro on Linux (but not on Windows)
Build ID: ea7cb86e6eeb2bf3a5af73a8f7777ac570321527
CPU threads: 1; OS: Linux 3.13; UI render: default; VCL: gtk2; 
Locale: en-US (en_US.UTF-8); Calc: group
Comment 11 Buovjaga 2018-05-25 12:05:22 UTC
(In reply to Telesto from comment #6)
> Created attachment 133999 [details]
> Sample File
> 1. Open attached fie
> 2. Select All (CTRL+A)
> 3. Apply Bold formatting (CTRL+B)
> 4. Save file (CTRL+S)
> 5. With still everything selected: Apply Italic (CTRL+I)
> 6. Save file (CTRL+S)
> 7. With still everything selected: Apply Underline (CTRL+U)
> 8. Save file (CTRL+S)
> 9. With still everything selected: Apply RED font color
> 10. Close the document (back to start center)
> 11. Open the document again. Repeat steps
> Saving steps are not a hard requirement
> Other opinions with the same effect
> 1. Playing with default styles
> 2. Remove formatting all formatting
> 3. Superscript
> Every steps adding up to quite some memory usage. Only repeating steps above
> 2 or 3 times creates a memory usage of 500 mb. 

I did this cycle 3 times, after reopening doing Ctrl-A, Ctrl-M to remove formatting. I did not observe this "adding up to quite some mem usage". After the third closing, I thought "hmm, now it did not go down", but then after I opened it, the mem use dropped by 30 MB again.

I think it would be worth it for everyone affected to re-test with master.

If dusk can still repro the leak, we really need an example file. This increase of gigabytes is certainly something that should be instantly recognisable.

Arch Linux 64-bit
Build ID: eeaf6dee2d278eaa037d95a756ad0ffab3314bc2
CPU threads: 8; OS: Linux 4.16; UI render: default; VCL: kde4; 
Locale: fi-FI (fi_FI.UTF-8); Calc: group
Built on May 24th 2018
Comment 12 Telesto 2018-08-12 19:29:13 UTC
Could you please try to reproduce it with the latest version of LibreOffice from https://www.libreoffice.org/download/libreoffice-fresh/ ?
I have set the bug's status to 'NEEDINFO'. Please change it back to 'UNCONFIRMED' if the bug is still present in the latest version.