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
    OUString aInURL = translateExternalUris(aInputURL);
    OUString aOutURL = translateExternalUris(aOutputURL);
    
    Reference< XDesktop2 > xDesktop = Desktop::create( 
::comphelper::getProcessComponentContext() );
    
    
    // create parameter array
    sal_Int32 nCount = 5;
    const desktop::CommandLineArgs& rArgs = 
desktop::Desktop::GetCommandLineArgs();
    aOutURL = desktop::GetURL_Impl( aOutURL, rArgs.getCwdUrl());
    
    Sequence < PropertyValue > aArgs( nCount );
    
    // mark request as user interaction from outside
    aArgs[0].Name = "Referer";
    aArgs[0].Value <<= OUString("private:OpenEvent");
    
    aArgs[1].Name = "ReadOnly";
    aArgs[2].Name = "OpenNewView";
    aArgs[3].Name = "Hidden";
    aArgs[4].Name = "Silent";
    
    OUString aName(desktop::GetURL_Impl( aInURL, rArgs.getCwdUrl()) );
    OUString aTarget("_default");
    
    // documents opened for printing are opened readonly because they must be opened 
as a new document and this
    // document could be open already
    aArgs[1].Value <<= sal_True;
    
    // always open a new document for printing, because it must be disposed 
afterwards
    aArgs[2].Value <<= sal_True;
    
    // printing is done in a hidden view
    aArgs[3].Value <<= sal_True;
    
    // load document for printing without user interaction
    aArgs[4].Value <<= sal_True;
    
    // hidden documents should never be put into open tasks
    aTarget = "_blank";
    
    // load the document ... if they are loadable!
    // Otherwise try to dispatch it ...
    Reference < XPrintable > xDoc;
    
    // This is a synchron loading of a component so we don't have to deal with our 
statusChanged listener mechanism.
    try
    {
        xDoc = Reference < XPrintable >( 
::comphelper::SynchronousDispatch::dispatch( xDesktop, aName, aTarget, 0, aArgs ), UNO_QUERY );
    }
    catch (const ::com::sun::star::lang::IllegalArgumentException& iae)
    {
        SAL_WARN(
                 
"desktop.app",
                 
"Dispatchwatcher IllegalArgumentException while calling"
                 " 
loadComponentFromURL: \"" << iae.Message << "\"");
    }
    catch (const com::sun::star::io::IOException& ioe)
    {
        SAL_WARN(
                 
"desktop.app",
                 
"Dispatchwatcher IOException while calling"
                 " 
loadComponentFromURL: \"" << ioe.Message << "\"");
    }
    
    
    if (xDoc.is() )
    {
        Reference< XStorable > xStorable( xDoc, UNO_QUERY 
);
        if ( xStorable.is() )
        {
            OUString aFilter = 
impl_GuessFilter( aName, aOutURL );
            
            Sequence<PropertyValue> 
conversionProperties( 2 );
            conversionProperties[0].Name = 
"Overwrite";
            conversionProperties[0].Value 
<<= sal_True;
            
            conversionProperties[1].Name = 
"FilterName";
            conversionProperties[1].Value 
<<= aFilter;
            
            OUString aTempName;
            
FileBase::getSystemPathFromFileURL( aName, aTempName );
            OString aSource8 = 
OUStringToOString ( aTempName, RTL_TEXTENCODING_UTF8 );
            
FileBase::getSystemPathFromFileURL( aOutURL, aTempName );
            OString aTargetURL8 = 
OUStringToOString(aTempName, RTL_TEXTENCODING_UTF8 );
            printf("convert %s -> %s 
using %s\n", aSource8.getStr(), aTargetURL8.getStr(),
                  
 OUStringToOString( aFilter, RTL_TEXTENCODING_UTF8 ).getStr());
            if( 
FStatHelper::IsDocument(aOutURL) )
                
printf("Overwriting: %s\n",OUStringToOString( aTempName, RTL_TEXTENCODING_UTF8 ).getStr() );
            try
            {
                
xStorable->storeToURL( aOutURL, conversionProperties );
            }
            catch (const Exception&)
            {
                fprintf( 
stderr, "Error: Please reverify input parameters...\n" );
            }
        }
    }
    
    // remove the document
    try
    {
        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();
        }
    }
    catch (const com::sun::star::util::CloseVetoException&)
    {
    }
Context
- memory release in libreoffice · Mahesh Patil
 
   
 
  Privacy Policy |
  
Impressum (Legal Info) |
  
Copyright information: Unless otherwise specified, all text and images
  on this website are licensed under the
  
Creative Commons Attribution-Share Alike 3.0 License.
  This does not include the source code of LibreOffice, which is
  licensed under the Mozilla Public License (
MPLv2).
  "LibreOffice" and "The Document Foundation" are
  registered trademarks of their corresponding registered owners or are
  in actual use as trademarks in one or more countries. Their respective
  logos and icons are also subject to international copyright laws. Use
  thereof is explained in our 
trademark policy.