OK, very good, I will upload the code to bugzilla. This might take a day or
two because I need to set up the required build environment (you use ant I
hope?) and I need to modify the sources (I can use subclassing instead of
composition when the code is a part of the poi package. This will shrink the
code hugely because a large number of proxy functions will no longer be
needed.).


Just to be sure, here a more detailed description of what exactly I have
done:
 

The BigGridDemo can be described as follows:



Create a XSSFWorkbook and from it any number of XSSFSheets via
Workbook.createSheet().


You can call any method on both the Workbook and the sheet besides
Sheet.createRow().


Create XML files using the class SpreadsheetWriter that contain the rows and
cells of the data.


Call Workbook.write() to save the document to a temporary file. Then replace
the sheets files contained in this file with the XML documents containing
the rows and cells of the data to create the final result file.



This scheme was improved so that one may call Sheet.createRow() and
Row.createCell() too and one may call any methods on the classes Row and
Cell.


In analogy to the description above this scheme can be desribed as follows:



Create a SXSSFWorkbook and from it any number of SXSSFSheets via
Workbook.createSheet()


You can call any method on both the Workbook and the sheet.


Create any number of SXSSFRows via Sheet.createRow()


You can call any method on the created Rows.


There is a limitation on how many rows can be accessed at one time in
memory. The default is 5000 rows. When the 5001th row is created then the 
  first row is flushed to the disk. The value of 5000 can be changed to some
other value via a call to SXSSFSheet.setRandomAccessWindowSize(int value).
  Setting a value of -1 will disable the automatic flushing and flushing can
be done manually by calling SXSSFSheet.flushRows(int remaining).


Create any number of SXSSFCells via Row.createCell()


You can call any method on the created Cells.


Call Workbook.write() to save the document to the final result file. The
patching is done transparently.


Note that there is no imposed order (apart from requiring Workbook.write()
to be called at the end) on the calling sequence of functions. Just like on
the normal API one can switch between workbooks, sheets, rows and cells
freely as long as the rows are still in the random access window. 


Regards,

Alex



--
View this message in context: 
http://apache-poi.1045710.n5.nabble.com/HSSF-and-XSSF-memory-usage-some-numbers-tp4312784p4372383.html
Sent from the POI - User mailing list archive at Nabble.com.

Reply via email to