Throw up some code. It'll be easier to see if you're doing anything wrong.

Adrian

On 27 October 2014 19:43, Mohan Nuggehally <[email protected]>
wrote:

> Mark,
>
> Thanks for the response.
>
> I have a loop going over rows and columns where in I do "XSSFRow row =
> sheet.createRow(row_i)"  and "XSSFCell cell = row.createCell(column_j)". I
> am under the impression that the "row" and "cell" objects are destroyed
> automatically once it comes out the scope of the loop. Am I
> misunderstanding something ? Do I need to explicitly destroy them ? If so
> how ?
>
> Regards,
> -Mohan
>
> On Mon, Oct 27, 2014 at 3:27 PM, MARK GOLDEN <[email protected]>
> wrote:
>
> > Hi Mohan,
> >
> > Are you cleaning up unwanted objects?
> >
> > The JVM will simply expand, surprising quickly, if you do not 'Destroy'
> > objects you no longer need.
> >
> > Regards,
> > Mark.
> >
> >
> > ________________________________
> >  From: Mohan Nuggehally <[email protected]>
> > To: [email protected]
> > Sent: Monday, 27 October 2014, 19:14
> > Subject: out of memory and GC overhead limit error
> >
> >
> > I get this error when I try to create an excel sheet using xssf. All I am
> > doing is creating rows and columns by reading contents from a file. Of
> > course when I change the max heap size from 1GB to 6GB it works. I wonder
> > if 1GB is really too small or is the code bad and therefore requires a
> huge
> > heap. Any experiences ? Here is the error stack.
> > -------------
> > Exception in thread "main" java.lang.OutOfMemoryError: Java heap space
> >     at
> >
> >
> org.apache.poi.ss.util.CellReference.convertNumToColString(CellReference.java:433)
> >     at
> >
> >
> org.apache.poi.ss.util.CellReference.appendCellReference(CellReference.java:492)
> >     at
> >
> org.apache.poi.ss.util.CellReference.formatAsString(CellReference.java:455)
> >     at
> org.apache.poi.xssf.usermodel.XSSFCell.setCellNum(XSSFCell.java:710)
> >     at org.apache.poi.xssf.usermodel.XSSFRow.createCell(XSSFRow.java:175)
> >     at org.apache.poi.xssf.usermodel.XSSFRow.createCell(XSSFRow.java:147)
> >     at org.apache.poi.xssf.usermodel.XSSFRow.createCell(XSSFRow.java:39)
> >     at
> > GraphWriteFull_to_Excel.create_sheet(GraphWriteFull_to_Excel.java:150)
> >     at GraphWriteFull_to_Excel.main(GraphWriteFull_to_Excel.java:79)
> > ----------------
> > The error stack is different as below when I set the max heap size to 4GB
> > --------------
> > Exception in thread "main" java.lang.OutOfMemoryError: GC overhead limit
> > exceeded
> >     at java.util.Arrays.copyOfRange(Arrays.java:2694)
> >     at java.lang.String.<init>(String.java:203)
> >     at java.lang.String.copyValueOf(String.java:2908)
> >     at java.io.StreamTokenizer.nextToken(StreamTokenizer.java:702)
> >     at
> > GraphWriteFull_to_Excel.create_sheet(GraphWriteFull_to_Excel.java:151)
> >     at GraphWriteFull_to_Excel.main(GraphWriteFull_to_Excel.java:79)
> > ---------------
> > I appreciate any feedback.
> >
> > Regards,
> > -Mohan
> >
> > --
> > Mohan Nuggehally
> > Senior Developer, Es-ice
> > Office: Direct dial: 1-631-760-3244
> >            Internal extension: 25172
> > New York
> >
>
>
>
> --
> Mohan Nuggehally
> Senior Developer, Es-ice
> Office: Direct dial: 1-631-760-3244
>            Internal extension: 25172
> New York
>

Reply via email to