To comment on the following update, log in, then open the issue:
http://www.openoffice.org/issues/show_bug.cgi?id=48642
                  Issue #:|48642
                  Summary:|Memory leak after making Writer tables via PyUNO
                          |session
                Component:|udk
                  Version:|OOo 1.1.4
                 Platform:|PC
                      URL:|
               OS/Version:|Linux
                   Status:|UNCONFIRMED
        Status whiteboard:|
                 Keywords:|
               Resolution:|
               Issue type:|DEFECT
                 Priority:|P3
             Subcomponent:|code
              Assigned to:|kr
              Reported by:|geoffteale





------- Additional comments from [EMAIL PROTECTED] Tue May  3 08:51:39 -0700 
2005 -------
It seems that when you run OpenOffice.org as a "server" using the "accept"
command line it is possible to make it leak memory by repeatedly running a
Python script that connects with PyUNO, writes some tabular data into a Writer
document, and then saves it as a PDF file.  Our code is leaking around 1MB per
script, but here is an example that seems to cause soffice.bin to leak around
about 0.2MB per invocation:

import uno
from com.sun.star.beans import PropertyValue
from com.sun.star.util import CloseVetoException
from com.sun.star.lang import DisposedException
from com.sun.star.io import IOException
from com.sun.star.connection import NoConnectException
from com.sun.star.util import XModifyListener
import unohelper


if __name__ == "__main__":
    local_context = uno.getComponentContext()
    local_service_manager = local_context.ServiceManager
    resolver = local_service_manager.createInstanceWithContext(
        'com.sun.star.bridge.UnoUrlResolver', local_context)
    connection_string = \
        "uno:socket,host=localhost,port=2002;urp;StarOffice.ComponentContext"
    remote_context = resolver.resolve(connection_string)
    remote_service_manager = remote_context.ServiceManager
    desktop_class = 'com.sun.star.frame.Desktop'
    desktop = remote_service_manager.createInstanceWithContext(desktop_class, 
                                                               remote_context)
    properties = ()
    url = "private:factory/swriter"
    document = desktop.loadComponentFromURL(url, "_blank", 0, properties)    
    text = document.Text
    cursor = text.createTextCursor()
    text.insertString( cursor, "Hello World", 0 )

    table_count = 0
    while table_count < 5:
        table = document.createInstance( "com.sun.star.text.TextTable" )
        table.initialize(40,4)
        text.insertTextContent( cursor, table, 0 )
        for i in range(1, 41):
            for letter in ("A", "B", "C", "D"):
                name = "%s%i" % (letter, i)
                cell = table.getCellByName(name)
                cell_cursor = cell.createTextCursor()
                cell .setString(name)
        table_count += 1

    export_format = "writer_pdf_Export"
    export_properties =  (PropertyValue('FilterName', 0, export_format, 0),
                          PropertyValue('Overwrite', 0, True, 0),)
    export_url = unohelper.systemPathToFileUrl("/home/gteale/foo.pdf")
    document.storeToURL(export_url, export_properties)
    try:
        document.close(True)
    except CloseVetoException:
        pass

---------------------------------------------------------------------
Please do not reply to this automatically generated notification from
Issue Tracker. Please log onto the website and enter your comments.
http://qa.openoffice.org/issue_handling/project_issues.html#notification

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to