Bug 106140 - Possible unmanaged memory leak
Summary: Possible unmanaged memory leak
Status: RESOLVED INSUFFICIENTDATA
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: sdk (show other bugs)
Version:
(earliest affected)
5.3.0.3 release
Hardware: x86-64 (AMD64) Windows (All)
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-02-22 16:19 UTC by Simone
Modified: 2017-09-29 08:54 UTC (History)
2 users (show)

See Also:
Crash report or crash signature:


Attachments
Code to reproduce the problem and the result of ANTS Memory Profiler (566.91 KB, application/zip)
2017-02-22 16:19 UTC, Simone
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Simone 2017-02-22 16:19:40 UTC
Created attachment 131411 [details]
Code to reproduce the problem and the result of ANTS Memory Profiler

I use LibreOffice in a C# project in which I have to work on many files, but I still have problems.

For each file to be processed, I open LibreOffice with 'uno.util.Bootstrap.bootstrap()' and I close it with 'xDesktop2.terminate()'.

After closing LibreOffice, the memory used in my program is not freed.
The private bytes continue to increase while bytes in all Heaps remain constant.

One of the modules that continues to increase the used memory (unmanaged memory) is 'cppuhelper3MSC'.

Only when I close my application, the memory is freed.

I saw the bug #41288, but do not know if it is a duplicate.

I attach the code I used to reproduce the problem and the result of ANTS Memory Profiler.
Comment 1 Julien Nabet 2017-02-23 10:51:56 UTC
Reading your code, I noticed this part:
      for (var i = 0; i < 500; i++)
      {
        using (var document = new TextDocument())
        {
          //document.Open(Path.Combine(Environment.CurrentDirectory, "Files", "Document.odt"));
        }
      }

Shouldn't there a delete instruction for each loop?
I mean, isn't it normal memory consumption increases when the number of TextDocument objects increases?
Comment 2 Simone 2017-02-23 13:44:31 UTC
Yes there is.
"var document = new TextDocument()" is declared in a using statement.
When document go out of scope, is automatically called document.dispose().
Then it should be responsibility of Garbage Collection of .NET to free memory.

Did I forget something after calling xDesktop2.terminate()?
I am not an expert, I just started and I have not found many examples of this.
Comment 3 Julien Nabet 2017-02-28 20:44:53 UTC
Since it concerns some dev, I'd suggest to dev forum (see http://nabble.documentfoundation.org/Dev-f1639786.html) or give a try to IRC (see https://wiki.documentfoundation.org/Website/IRC)
Comment 4 Xisco Faulí 2017-03-02 12:05:26 UTC
As comment 3 suggested, please ask in the dev mailling list or in the IRC channel.
Setting to NEEDINFO until the previous actios is done.
Comment 5 QA Administrators 2017-08-30 19:27:53 UTC Comment hidden (obsolete)
Comment 6 QA Administrators 2017-09-29 08:54:56 UTC
Dear Bug Submitter,

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-20170929