title: java.lang.OutOfMemoryError: Java heap space in JasperReports
body: <p>In my swing application when I am going to print,  following exception is given.but not always, like trice a time. it occurs when the following code is executed in jasper reporting. How can I solve this issue?</p>
  
  <pre>
      Exception occurred during event dispatching:
      java.lang.OutOfMemoryError: Java heap space  
  </pre>
  
  <pre><code>        JRBeanCollectionDataSource datasource = new JRBeanCollectionDataSource(purchasingList);
          JasperPrint jasperPrint = JasperFillManager.fillReport(in, params, datasource);
  
          if (view) {// using a JDialog a preview of the print is showed.
               new Shows().showJasper(jasperPrint, "Invoice No:" + invoiceNo);
          }
  
          final JRPrintServiceExporter exporter = new JRPrintServiceExporter();
          exporter.setParameter(JRExporterParameter.JASPER_PRINT, jasperPrint);
  //      exporter.setParameter(JRPrintServiceExporterParameter.DISPLAY_PAGE_DIALOG, Boolean.FALSE);
          exporter.setParameter(JRPrintServiceExporterParameter.DISPLAY_PRINT_DIALOG, Boolean.TRUE);
          exporter.exportReport();
  </code></pre>