[Solved+Issue] xcomponent - dispose or close

Creating a macro - Writing a Script - Using the API (OpenOffice Basic, Python, BeanShell, JavaScript)
Post Reply
fischel
Posts: 5
Joined: Wed Oct 17, 2012 9:40 pm

[Solved+Issue] xcomponent - dispose or close

Post by fischel »

Hi,

when I open a doc with xComponentLoader.loadComponentFromURL(filename, "_blank", 0, null) in Java, what is the right way to close it really??

I tried it with document.dispose() and I tried it with

Code: Select all

XCloseable xClose = (XCloseable)UnoRuntime.queryInterface(XCloseable.class, document);
xClose.close(true);
but after the script is finished the memory of openoffice soffice it higher than before. When I execute the script several times, the mem increase more and more.

Can anybody give me some help?

thank you
Stephan

Code: Select all

mysystem: debian6, openoffice3.2., sunjava6
startoo with:/usr/bin/soffice -invisible -nologo -nofirststartwizard -norestore -accept="socket,host=127.0.0.1,port=8100;urp" 
Last edited by fischel on Mon Dec 31, 2012 12:48 am, edited 1 time in total.
Stephan Fischer
Berlin
F3K Total
Volunteer
Posts: 1038
Joined: Fri Dec 16, 2011 8:20 pm

Re: xcomponent - dispose or close

Post by F3K Total »

Hello,
i did try and error with a starbasic code and found out, that's not a question of or but of and:

Code: Select all

Sub S_loadcomponent_and_close
    oDoc = StarDesktop.loadComponentFromURL("private:factory/scalc","_blank", 0, Array())
    msgbox "open" 'look at memory use
    odoc.dispose()
    oDoc.close -1
    'look at memory use again
End Sub
HTH
R
  • MMove 1.0.6
  • Extension for easy, exact positioning of shapes, pictures, controls, frames ...
  • my current system
  • Windows 10 AOO, LOLinux Mint AOO, LO
fischel
Posts: 5
Joined: Wed Oct 17, 2012 9:40 pm

Re: xcomponent - dispose or close

Post by fischel »

Ok,

I found this helpful link, that describe how to close a document the best way with an example code:
http://wiki.openoffice.org/wiki/Documen ... _Documents

With this, my documents were closed perfect. But this doesn't solve my problem of increase memory of soffice. If I open and close documents with UNO the memory of soffice will increase every time. I think it's a OO/UNO-Bug since 7 years now !!!!

https://issues.apache.org/ooo/show_bug.cgi?id=41675

Happy Birthday Bug :)
Stephan Fischer
Berlin
Post Reply