[Solved] xcell.setvalue - memory increase?

The Application Programming Interface and the OASIS Open Document Format

[Solved] xcell.setvalue - memory increase?

Postby fischel » Sat Dec 29, 2012 11:44 pm

Hi,

I hope some of you can help me :) In Java I open an existing file (ods) as a spreadsheetdoc. Then I write a value in one cell several times. In that time, the memory increase and will not going down (even after the script is finished). After a longer time I got an "out of memory" error. The memory of the "soffice" will increase, not the java process! I try to disable undo, but that doesn't help.

So if anyone has any idea, let me know?? I want to use that script as a service for an web-app. But with this memory-leak it is worse.

thank you.
Stephan

main source-code
Code: Select all   Expand viewCollapse view
// I even try with _blank
XComponent document = (XComponent)xComponentLoader.loadComponentFromURL(filename, "_default", 0, null);
XSpreadsheetDocument xSpreadsheetDocument = (XSpreadsheetDocument) UnoRuntime.queryInterface(XSpreadsheetDocument.class, document);
           
// XPropertySet xPropSet = (XPropertySet)UnoRuntime.queryInterface(XPropertySet.class, xSpreadsheetDocument);
// xPropSet.setPropertyValue("IsUndoEnabled", new Boolean(false));
// System.out.println(xPropSet.getPropertyValue( "IsUndoEnabled"));
           
XSpreadsheets xSpreadsheets = xSpreadsheetDocument.getSheets();
XIndexAccess xIndexedSheets = (XIndexAccess) UnoRuntime.queryInterface( XIndexAccess.class, xSpreadsheets);

Object sheet = xIndexedSheets.getByIndex(0);
XSpreadsheet xSheet = (XSpreadsheet) UnoRuntime.queryInterface(XSpreadsheet.class, sheet);

XCell xCellRoom = xSheet.getCellByPosition(3, 13);
for (int t = 1; t < 5000; t++) {
   // with every setvalue mem increase ??
   xCellRoom.setValue((double)t);
   System.out.println("room: " + xCellRoom.getValue());           
}     


Code: Select all   Expand viewCollapse view
mysystem: debian6, openoffice3.2, sun java 1.6
start OO 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:39 am, edited 1 time in total.
Stephan Fischer
Berlin
fischel
 
Posts: 5
Joined: Wed Oct 17, 2012 9:40 pm

Re: xcell.setvalue - memory increase?

Postby fischel » Mon Dec 31, 2012 12:39 am

It's unbelievable, but I found a solution myself!!

On my debian-server I startet my OO normally with the headless option :

Code: Select all   Expand viewCollapse view
/usr/bin/soffice -headless -nologo -nofirststartwizard -norestore -accept="socket,host=127.0.0.1,port=8100;urp"


But this is wrong! In the headless-mode my test-script increase the memory of soffice on and on. But when I start it without headless and use xvfb than there is no memory-leak!

Code: Select all   Expand viewCollapse view
Xvfb :1 -screen 0 1024x768x24 -fbdir /tmp &
/usr/bin/soffice -nologo -nofirststartwizard -norestore -accept="socket,host=127.0.0.1,port=8100;urp" -display :1  &


Unbelievalbe it works! Remind, open and close a document increase memory even if you use headless-mode or xvfb when you use UNO.

So I hope this information maybe can help you. :)
Stephan Fischer
Berlin
fischel
 
Posts: 5
Joined: Wed Oct 17, 2012 9:40 pm


Return to UNO API and ODF

Who is online

Users browsing this forum: No registered users and 1 guest