Re: memory release in libreoffice

2014-07-11 Thread Eike Rathke
Hi Mahesh,

Please keep discussions on the mailing list instead of moving them to
private mail only, I'm Cc'ing the list again.

On Friday, 2014-07-11 12:28:43 -, Mahesh Patil wrote:

 Mac OS Xcode has such tools which tell you memory leaks with exact num of 
 bytes and it's allocation function.
 
 I found some memory leaks but main problem is that I build static library on 
 mac and ConvertData is duplicate struct and class. So this causes problem 
 ConvertData destructor is not called properrly so I rename one of them in 
 scaddin.One random crash also found but I don't know how to contact mac os 
 developer on libreoffice. I know exact proble I fixed also..

I see struct ConvertData in include/vcl/salctype.hxx and class
ConvertData in scaddins/source/analysis/analysishelper.hxx
Both should be independent from each other, i.e. scaddins does not see
the vcl struct or vice versa. Anyway, renaming the scaddin one helped in
your static library case? (whyever you build a static lib is beyond my
scope...)

  Eike

-- 
LibreOffice Calc developer. Number formatter stricken i18n transpositionizer.
GPG key ID: 0x65632D3A - 2265 D7F3 A7B0 95CC 3918  630B 6A6C D5B7 6563 2D3A
Support the FSFE, care about Free Software! https://fsfe.org/support/?erack


pgpqkb8Ov4pGi.pgp
Description: PGP signature
___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice


Re: memory release in libreoffice

2014-07-10 Thread Eike Rathke
Hi Mahesh,

On Tuesday, 2014-07-08 07:47:46 -, Mahesh Patil wrote:

 Libreoffice is not releasing memory after converting document to pdf.

How do you measure that?

  Eike

-- 
LibreOffice Calc developer. Number formatter stricken i18n transpositionizer.
GPG key ID: 0x65632D3A - 2265 D7F3 A7B0 95CC 3918  630B 6A6C D5B7 6563 2D3A
Support the FSFE, care about Free Software! https://fsfe.org/support/?erack


pgpN1xPG9nN6t.pgp
Description: PGP signature
___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice


memory release in libreoffice

2014-07-09 Thread Mahesh Patil
Hi,

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.

Thanks and Regards,
Mahesh

sample code

input is word document and output is pdf document

nbsp;nbsp;nbsp; OUString aInURL = translateExternalUris(aInputURL);
nbsp;nbsp;nbsp; OUString aOutURL = translateExternalUris(aOutputURL);
nbsp;nbsp;nbsp; 
nbsp;nbsp;nbsp; Referencelt; XDesktop2 gt; xDesktop = Desktop::create( 
::comphelper::getProcessComponentContext() );
nbsp;nbsp;nbsp; 
nbsp;nbsp;nbsp; 
nbsp;nbsp;nbsp; // create parameter array
nbsp;nbsp;nbsp; sal_Int32 nCount = 5;
nbsp;nbsp;nbsp; const desktop::CommandLineArgsamp; rArgs = 
desktop::Desktop::GetCommandLineArgs();
nbsp;nbsp;nbsp; aOutURL = desktop::GetURL_Impl( aOutURL, rArgs.getCwdUrl());
nbsp;nbsp;nbsp; 
nbsp;nbsp;nbsp; Sequence lt; PropertyValue gt; aArgs( nCount );
nbsp;nbsp;nbsp; 
nbsp;nbsp;nbsp; // mark request as user interaction from outside
nbsp;nbsp;nbsp; aArgs[0].Name = Referer;
nbsp;nbsp;nbsp; aArgs[0].Value lt;lt;= OUString(private:OpenEvent);
nbsp;nbsp;nbsp; 
nbsp;nbsp;nbsp; aArgs[1].Name = ReadOnly;
nbsp;nbsp;nbsp; aArgs[2].Name = OpenNewView;
nbsp;nbsp;nbsp; aArgs[3].Name = Hidden;
nbsp;nbsp;nbsp; aArgs[4].Name = Silent;
nbsp;nbsp;nbsp; 
nbsp;nbsp;nbsp; OUString aName(desktop::GetURL_Impl( aInURL, 
rArgs.getCwdUrl()) );
nbsp;nbsp;nbsp; OUString aTarget(_default);
nbsp;nbsp;nbsp; 
nbsp;nbsp;nbsp; // documents opened for printing are opened readonly because 
they must be opened as a new document and this
nbsp;nbsp;nbsp; // document could be open already
nbsp;nbsp;nbsp; aArgs[1].Value lt;lt;= sal_True;
nbsp;nbsp;nbsp; 
nbsp;nbsp;nbsp; // always open a new document for printing, because it must 
be disposed afterwards
nbsp;nbsp;nbsp; aArgs[2].Value lt;lt;= sal_True;
nbsp;nbsp;nbsp; 
nbsp;nbsp;nbsp; // printing is done in a hidden view
nbsp;nbsp;nbsp; aArgs[3].Value lt;lt;= sal_True;
nbsp;nbsp;nbsp; 
nbsp;nbsp;nbsp; // load document for printing without user interaction
nbsp;nbsp;nbsp; aArgs[4].Value lt;lt;= sal_True;
nbsp;nbsp;nbsp; 
nbsp;nbsp;nbsp; // hidden documents should never be put into open tasks
nbsp;nbsp;nbsp; aTarget = _blank;
nbsp;nbsp;nbsp; 
nbsp;nbsp;nbsp; // load the document ... if they are loadable!
nbsp;nbsp;nbsp; // Otherwise try to dispatch it ...
nbsp;nbsp;nbsp; Reference lt; XPrintable gt; xDoc;
nbsp;nbsp;nbsp; 
nbsp;nbsp;nbsp; // This is a synchron loading of a component so we don't 
have to deal with our statusChanged listener mechanism.
nbsp;nbsp;nbsp; try
nbsp;nbsp;nbsp; {
nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp; xDoc = Reference lt; XPrintable 
gt;( ::comphelper::SynchronousDispatch::dispatch( xDesktop, aName, aTarget, 0, 
aArgs ), UNO_QUERY );
nbsp;nbsp;nbsp; }
nbsp;nbsp;nbsp; catch (const 
::com::sun::star::lang::IllegalArgumentExceptionamp; iae)
nbsp;nbsp;nbsp; {
nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp; SAL_WARN(
nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;
 desktop.app,
nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;
 Dispatchwatcher IllegalArgumentException while calling
nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;
  loadComponentFromURL: \ lt;lt; iae.Message lt;lt; \);
nbsp;nbsp;nbsp; }
nbsp;nbsp;nbsp; catch (const com::sun::star::io::IOExceptionamp; ioe)
nbsp;nbsp;nbsp; {
nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp; SAL_WARN(
nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;
 desktop.app,
nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;
 Dispatchwatcher IOException while calling
nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;
  loadComponentFromURL: \ lt;lt; ioe.Message lt;lt; \);
nbsp;nbsp;nbsp; }
nbsp;nbsp;nbsp; 
nbsp;nbsp;nbsp; 
nbsp;nbsp;nbsp; if (xDoc.is() )
nbsp;nbsp;nbsp; {
nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp; Referencelt; XStorable gt; 
xStorable( xDoc, UNO_QUERY );
nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp; if ( xStorable.is() )
nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp; {
nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp; OUString 
aFilter = impl_GuessFilter( aName, aOutURL );
nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp; 
nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp; 
Sequencelt;PropertyValuegt; conversionProperties( 2 );
nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp; 
conversionProperties[0].Name = Overwrite;
nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp; 
conversionProperties[0].Value lt;lt;= sal_True;
nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp; 
nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp; 
conversionProperties[1].Name = FilterName;
nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp; 
conversionProperties[1].Value lt;lt;= aFilter;
nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp; 
nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp; OUString 
aTempName;

Re: memory release in libreoffice

2014-07-09 Thread Michael Meeks
Hi Mahesh,

On Tue, 2014-07-08 at 07:47 +, 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.is() )
 xClose-close( sal_True );
 else
 {
 Reference  XComponent  xComp( xDoc, UNO_QUERY );
 if ( xComp.is() )
 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
easier.

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 ?

Thanks,

Michael.

-- 
 michael.me...@collabora.com  , Pseudo Engineer, itinerant idiot

___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice


Re: memory release in libreoffice

2014-07-09 Thread Michael Stahl
On 09/07/14 12:07, Michael Meeks wrote:
 
 Reference  XCloseable  xClose( xDoc, UNO_QUERY );
 if ( xClose.is() )
 xClose-close( sal_True );
 else
 {
 Reference  XComponent  xComp( xDoc, UNO_QUERY );
 if ( xComp.is() )
 xComp-dispose();
 }
 
   It is possible that you want to do the dispose after the close
 unconditionally; but I'm really no expert here.

no you don't - the close() is an enhanced alternative to dispose(),
and if a component supports XCloseable you should never call dispose()
on it.


___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice