If I recall, for a 4mb spreadsheet, 110 mb of heap space was required
(IIRC, after 1.0x this actually increased by 20-30mb due to performance
optimizations, however the performance optimizations were tenfold).
This may be slightly smaller or larger depeding on the amount of
repetitive string data so I'd set it to 120mb just to be safe. For 2.0
our primary goal is feature support. I'm considering doing some fairly
significant revamping of our object model for 3.0 (read: no more cell
value objects, staticly mapped utility classes to a large byte array) in
order to reduce memory consumption. The reason I did not want to do
this for 1.0 or 2.0 is that it will reduce code readibility and hence
our abillity to debug and implement new features. After 2.0 most of our
features will no longer be related to normal cell types so this concern
will largely become moot.
For now, POI's memory sweetspot is spreadsheets from 300k - 1mb.
(smaller is fine too of course) In the event of larger sheets I would
not recommend generating them on the fly at this point.
-Andy
[EMAIL PROTECTED] wrote:
>I am trying to create excel files of moderate to large size (about 4 MB). I have
>written some code to generate a file for this and I have also increased my JVM heap
>size to 100 MB. The code compiles and runs without a problem. However, my Excel
>application is unable open the file (e.g.. "Out of memory" or similar errors). I've
>pasted my code below, does know why this is causing me a problem?
>
>(I have already looked through the archives and noticed that someone had a similar
>problem. The recommended solution was to increase the JVM heap size which I have
>tried. Does anyone know what the heap size should be relative to the file size or
>even if there is an issue with this)
>
>
>Thank you in advance,
>
>Nitin.
>
>
>
>import org.apache.poi.hssf.usermodel.*;
>import java.io.*;
>
>public class createExcelSheet
>{
>
> public static void main(String args[]) throws Throwable
> {
> HSSFWorkbook wb = new HSSFWorkbook();
> HSSFSheet sheet1 = wb.createSheet("new sheet");
>
> for (short index = 0; index < 600; index ++)
> {
> HSSFRow row = sheet1.createRow(index);
> for (short index2 = 0; index2 < 500; index2++)
> {
> row.createCell(index2).setCellValue("goodbye");
> }
> }
>
> FileOutputStream fileOut = new FileOutputStream("workbook.xls");
> wb.write(fileOut);
> fileOut.close();
> }
>}
>
>Visit our website at http://www.ubswarburg.com
>
>This message contains confidential information and is intended only
>for the individual named. If you are not the named addressee you
>should not disseminate, distribute or copy this e-mail. Please
>notify the sender immediately by e-mail if you have received this
>e-mail by mistake and delete this e-mail from your system.
>
>E-mail transmission cannot be guaranteed to be secure or error-free
>as information could be intercepted, corrupted, lost, destroyed,
>arrive late or incomplete, or contain viruses. The sender therefore
>does not accept liability for any errors or omissions in the contents
>of this message which arise as a result of e-mail transmission. If
>verification is required please request a hard-copy version. This
>message is provided for informational purposes and should not be
>construed as a solicitation or offer to buy or sell any securities or
>related financial instruments.
>
>
>--
>To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
>For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
>
>
>
>
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>