boxable icon indicating copy to clipboard operation
boxable copied to clipboard

OutOfMemoryError: gc overhead limit exceeded

Open dsp85103 opened this issue 5 years ago • 2 comments

When I generate a big pdf (it's a report, about 150,000~200,000 row data) Because I need to add statistics data, so I create Row & Cell by manual to custom my report

But I creating Row & Cell before drawtable, the ram direct up to ~3G from 400MB then I call draw(), Java throws the OutOfMemoryError exception... My JVM only setting 4G available memory..

Any one know how to improve this issue? Thanks

btw. I am not english native speaker ;) Maybe some semantics wrong ...

dsp85103 avatar Mar 16 '21 10:03 dsp85103

here is my create row and cell example code ` Row<PDPage> row = baseTable.createRow(10.f); Cell<PDPage> cell; cell = row.createCell(contentColWidth.get("name1"), df.format(totalModel.getName1()), HorizontalAlignment.CENTER, VerticalAlignment.MIDDLE); cell.setFont(font); cell.setFontSize(fontSize);

DecimalFormat df = new DecimalFormat(",###");

cell = row.createCell(contentColWidth.get("val1"), df.format(totalModel.getValue1()), HorizontalAlignment.RIGHT, VerticalAlignment.MIDDLE); cell.setFont(font); cell.setFontSize(fontSize);

cell = row.createCell(contentColWidth.get("val2"), df.format(totalModel.getValue2()), HorizontalAlignment.RIGHT, VerticalAlignment.MIDDLE); cell.setFont(font); cell.setFontSize(fontSize);

cell = row.createCell(contentColWidth.get("val3"), df.format(totalModel.getValue3()), HorizontalAlignment.RIGHT, VerticalAlignment.MIDDLE); cell.setFont(font); cell.setFontSize(fontSize);

cell = row.createCell(contentColWidth.get("val4"), df.format(totalModel.getValue4()), HorizontalAlignment.RIGHT, VerticalAlignment.MIDDLE); cell.setFont(font); cell.setFontSize(fontSize);

... one row about have 20 column `

And I use MAT tool to analyze the mem dump I got this https://i.imgur.com/xBjkGpC.png this package use a lot of object cause mem full

dsp85103 avatar Mar 16 '21 10:03 dsp85103

@dsp85103 Can you provide a sample project?

johnmanko avatar Jun 15 '22 13:06 johnmanko