incubator-odf-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Devin Han <devin...@apache.org>
Subject Re: Memory issues using Simple ODF
Date Thu, 20 Oct 2011 08:14:04 GMT
Hi,

Thanks for the report. I think the problem maybe caused by the "Sample.ods"
file. Please make sure the size of the sheet. For spreadsheet document,
there maybe a very large sheet in it(the biggest row is 1048576, biggest
column index is AMJ), but the user doesn't notice. As there is no content in
it. But no content doesn't mean the table is small. You can use
Table.getColumnCount() and Table.getRowCount() to check the table size.

I have another easy way to avoid it. Please use Table.getCellByPosition() to
replace appendColumn(), appendRows(). For example. if you want to set a
string for cell A1. just use

Cell odsCell=sheet1.getCellByPosition("A1");
odsCell.setStringValue("string");

Don't worry about the address may be out of range. The sheet will be
automatically expanded as need.

We have done lots of work to improve the performance, pls reference this
issue: https://issues.apache.org/jira/browse/ODFTOOLKIT-284

If this reply can't resolve your problem. Please let me know and attache
your test file and source code.

2011/10/20 Neelima <neelima.b@gmail.com>

> Hi,
>
> I have used ODF API for writing information into an ODS file. Following are
> the steps:
>
> 1. Load an ODS document from a location which acts as a template f or
> writing information. (Spead across different workSheets)
>
>     *SpreadsheetDocument ods =
>  SpreadsheetDocument.loadDocument("Sample.ods");*
> *
> *
> 2. Load the record from the database.
> 3. Write information of retrieved record from the database across different
> spreadsheets.
>        * //fetch rows and cell*
> *       cell.setStringValue("value");*
> *
> *
> 4. Append columns/rows when necessary as I progress loading each record and
> write to the ODS file.
>  *      Table sheet = ods.getSheetByIndex(0);*
> *       sheet.appendColumn();*
> *       //when I need to append rows*
> *        sheet.appendRows(2);*
> *       //when I have to insertRows*
> *        sheet.insertRowsBefore(8,2);*
>
> 5. Repeat steps 2-4  until all records are written to the database. At the
> end save the document to the desired location
>                *ods.save("Sample_Output.ods");*
> *                ods.close();*
> *
> *
> When our program is running and when we calculate memory usage by object
> ods,
> for every item its increasing to many folds and finally if we have around
> 500 records to be written to the file, it runs to OutOfMemory error even
> with a JVM heap size of 512M. We have a requirement wherein we have to
> write
> atleast a couple of 1000 records to the file.
> Below are some of the readings we have taken for the memory occupied by ods
> object (all in bytes): For 25 items it took almost 19MB of memory.
>
> *Memory used for item start when template ods file is loaded : 70904*
> *
> Memory used for item 1 is::6582856
> Memory used for item 2 is::7153712
> Memory used for item 3 is::7693304
> Memory used for item 4 is::8229752
> Memory used for item 5 is::8790632
> Memory used for item 6 is::9330904
> Memory used for item 7 is::9872280
> Memory used for item 8 is::10403760
> Memory used for item 9 is::10926408
> Memory used for item 10 is::11444312
> Memory used for item 11 is::11975584
> Memory used for item 12 is::12569264
> Memory used for item 13 is::13111056
> Memory used for item 14 is::13630656
> Memory used for item 15 is::14162408
> Memory used for item 16 is::14619104
> Memory used for item 17 is::15137664
> Memory used for item 18 is::15655856
> Memory used for item 19 is::16175768
> Memory used for item 20 is::16687440
> Memory used for item 21 is::17192536
> Memory used for item 22 is::17712152
> Memory used for item 23 is::18227080
> Memory used for item 24 is::18867536
> Memory used for item 25 is::19372664
> Memory used for item after all items are written and saved to file:
> 19180232
> *
>
> Please advise if am missing something in the API which needs to be used.
>
> Thanks & Regards,
> Neelima
>



-- 
-Devin

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message