memory release in libreoffice

Michael Meeks michael.meeks at
Wed Jul 9 03:07:08 PDT 2014

Hi Mahesh,

On Tue, 2014-07-08 at 07:47 +0000, Mahesh Patil wrote:
> I have problem in libreoffice code. Libreoffice is not releasing
> memory after converting document to pdf. Can someone explain me how to
> release memory. which function is called for this.

	Hmm - of course, it is quite possible / probable that there are memory
leaks - unfortunately.

>         Reference < XCloseable > xClose( xDoc, UNO_QUERY );
>         if ( )
>             xClose->close( sal_True );
>         else
>         {
>             Reference < XComponent > xComp( xDoc, UNO_QUERY );
>             if ( )
>                 xComp->dispose();
>         }

	It is possible that you want to do the dispose after the close
unconditionally; but I'm really no expert here.

	Have you considered using the LibreOfficeKit API in 4.3 ? (try a recent
4.3.0 rc) that provides a native C/C++ API for linking directly into the
LibreOffice process to do this work - which should make debugging rather

	Beyond that I'd suggest running the soffice.bin binary under lsan or
valgrind to detect leaks and see where the memory is lurking after that
cycle. With some clear leak traces it shouldn't be too hard to work out
what's going on. Unfortunately it is possible that what is apparently
leaked is image caches etc. that are cleaned up at exit (but not on
document close) which would hide the leaks.

	How much are you loosing ?



 michael.meeks at  <><, Pseudo Engineer, itinerant idiot

More information about the LibreOffice mailing list