Re: Out of Memory problem
I tried to increase memory of JVM through Tomcat - but not much change. I believe the way i am using my procedure (creating objects) that might be wrong. Below is some statistics (logger is displaying) when i am trying to render the PDF with 1 page / 2 pages / 3 pages etc 1 page report 2 pages report 3 pages report Initial Heap size ~ 12M 14M 10M Current Heap size ~ 64M 10M 9M Total memory used~ 52M 4M -1M If i try for 4 pages report then i get OutOfMemory Error. Once i get this error then even sometimes iget errors for 2 pages / 3pages report too. Total memory used always go in -ve later. I am attaching my procedure below which i use to render the pdf -- //Following method is used to render PDFpublic synchronized void renderPDF (...) throws Exception { ... get xsl file path get xml org.apache.fop.image.FopImageFactory.resetCache(); //get the user config file for pdf Arial unicode font File userConfigFile = new File(cnffilepath); Options options = new org.apache.fop.apps.Options(userConfigFile); TraxInputHandler xsltinput = new TraxInputHandler(new File(xmlpath), new File(xslpath));ByteArrayOutputStream outputPDFBuffer = new ByteArrayOutputStream();Driver driver = new Driver(); driver.setLogger(new org.apache.avalon.framework.logger.Log4JLogger(logger) );driver.setRenderer(Driver.RENDER_PDF);driver.setOutputStream(outputPDFBuffer);xsltinput.run(driver);FileOutputStream pdfDoc = new FileOutputStream(pdfpath);pdfDoc.write(outputPDFBuffer.toByteArray(), 0, outputPDFBuffer.size());pdfDoc.flush();pdfDoc.close();}//renderPDF- regards Manisha Chris Bowditch [EMAIL PROTECTED] wrote: Manisha Sathe wrote: Thanks Chris, Would appreciate if u can explain more how shall i increase memory in my case - I am on Tomcat server and using servlet to render the fop. I am not using fop.bat file, Which script starts my JVM - really speaking i also do not know.Well I havent used Tomcat, but I know it will be started by a shell script or batch file. You will need to find it and add the parameter -Xmx256M to the call to java. Ask on a tomcat specific list, this is getting somewhat off topic for FOP/XSL-FO.Chris__Do You Yahoo!?Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com
Re: Out of Memory problem
Can you send your xml and xsl file ? Ashish - Original Message - From: Manisha Sathe To: [EMAIL PROTECTED] Sent: 28 February, 2005 09:32 Subject: Re: Out of Memory problem I tried to increase memory of JVM through Tomcat - but not much change. I believe the way i am using my procedure (creating objects) that might be wrong. Below is some statistics (logger is displaying) when i am trying to render the PDF with 1 page / 2 pages / 3 pages etc 1 page report 2 pages report 3 pages report Initial Heap size ~ 12M 14M 10M Current Heap size ~ 64M 10M 9M Total memory used~ 52M 4M -1M If i try for 4 pages report then i get OutOfMemory Error. Once i get this error then even sometimes iget errors for 2 pages / 3pages report too. Total memory used always go in -ve later. I am attaching my procedure below which i use to render the pdf -- //Following method is used to render PDFpublic synchronized void renderPDF (...) throws Exception { ... get xsl file path get xml org.apache.fop.image.FopImageFactory.resetCache(); //get the user config file for pdf Arial unicode font File userConfigFile = new File(cnffilepath); Options options = new org.apache.fop.apps.Options(userConfigFile); TraxInputHandler xsltinput = new TraxInputHandler(new File(xmlpath), new File(xslpath));ByteArrayOutputStream outputPDFBuffer = new ByteArrayOutputStream();Driver driver = new Driver(); driver.setLogger(new org.apache.avalon.framework.logger.Log4JLogger(logger) );driver.setRenderer(Driver.RENDER_PDF);driver.setOutputStream(outputPDFBuffer);xsltinput.run(driver);FileOutputStream pdfDoc = new FileOutputStream(pdfpath);pdfDoc.write(outputPDFBuffer.toByteArray(), 0, outputPDFBuffer.size());pdfDoc.flush();pdfDoc.close();}//renderPDF- regards Manisha Chris Bowditch [EMAIL PROTECTED] wrote: Manisha Sathe wrote: Thanks Chris, Would appreciate if u can explain more how shall i increase memory in my case - I am on Tomcat server and using servlet to render the fop. I am not using fop.bat file, Which script starts my JVM - really speaking i also do not know.Well I havent used Tomcat, but I know it will be started by a shell script or batch file. You will need to find it and add the parameter -Xmx256M to the call to java. Ask on a tomcat specific list, this is getting somewhat off topic for FOP/XSL-FO.Chris __Do You Yahoo!?Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com
Re: Out of Memory problem
i am generating xml file on fly. Giving one sample of xml. Pls ignore chinese characters (copied any dummy things inside), Iam usingArial Unicode MS font. regards ManishaAshish [EMAIL PROTECTED] wrote: Can you send your xml and xsl file ? Ashish - Original Message - From: Manisha Sathe To: [EMAIL PROTECTED] Sent: 28 February, 2005 09:32 Subject: Re: Out of Memory problem I tried to increase memory of JVM through Tomcat - but not much change. I believe the way i am using my procedure (creating objects) that might be wrong. Below is some statistics (logger is displaying) when i am trying to render the PDF with 1 page / 2 pages / 3 pages etc 1 page report 2 pages report 3 pages report Initial Heap size ~ 12M 14M 10M Current Heap size ~ 64M 10M 9M Total memory used~ 52M 4M -1M If i try for 4 pages report then i get OutOfMemory Error. Once i get this error then even sometimes iget errors for 2 pages / 3pages report too. Total memory used always go in -ve later. I am attaching my procedure below which i use to render the pdf -- //Following method is used to render PDFpublic synchronized void renderPDF (...) throws Exception { ... get xsl file path get xml org.apache.fop.image.FopImageFactory.resetCache(); //get the user config file for pdf Arial unicode font File userConfigFile = new File(cnffilepath); Options options = new org.apache.fop.apps.Options(userConfigFile); TraxInputHandler xsltinput = new TraxInputHandler(new File(xmlpath), new File(xslpath));ByteArrayOutputStream outputPDFBuffer = new ByteArrayOutputStream();Driver driver = new Driver(); driver.setLogger(new org.apache.avalon.framework.logger.Log4JLogger(logger) );driver.setRenderer(Driver.RENDER_PDF);driver.setOutputStream(outputPDFBuffer);xsltinput.run(driver);FileOutputStream pdfDoc = new FileOutputStream(pdfpath);pdfDoc.write(outputPDFBuffer.toByteArray(), 0, outputPDFBuffer.size());pdfDoc.flush();pdfDoc.close();}//renderPDF- regards Manisha Chris Bowditch [EMAIL PROTECTED] wrote: Manisha Sathe wrote: Thanks Chris, Would appreciate if u can explain more how shall i increase memory in my case - I am on Tomcat server and using servlet to render the fop. I am not using fop.bat file, Which script starts my JVM - really speaking i also do not know.Well I havent used Tomcat, but I know it will be started by a shell script or batch file. You will need to find it and add the parameter -Xmx256M to the call to java. Ask on a tomcat specific list, this is getting somewhat off topic for FOP/XSL-FO.Chris __Do You Yahoo!?Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com Do you Yahoo!? Yahoo! Sports - Sign up for Fantasy Baseball.?xml version=1.0 encoding=UTF-8? xsl:stylesheet version=1.0 xmlns:xsl=http://www.w3.org/1999/XSL/Transform; xmlns:fo=http://www.w3.org/1999/XSL/Format; xsl:template match=Advertisement fo:root xmlns:fo=http://www.w3.org/1999/XSL/Format; fo:layout-master-set fo:simple-page-master master-name=advertisement page-height=29.7cm page-width=22cm margin-top=2cm margin-bottom=2cm margin-left=2.0cm margin-right=2.0cm fo:region-body margin-top=0cm/ fo:region-before extent=0cm/ fo:region-after extent=1cm/ /fo:simple-page-master /fo:layout-master-set xsl:apply-templates select=AdvertPage/ /fo:root /xsl:template xsl:template match=AdvertPage fo:page-sequence master-reference=advertisement fo:flow flow-name=xsl-region-body fo:table table-layout=fixed fo:table-column column-width=18cm / fo:table-body fo:table-row fo:table-cell display-align=center background-color=rgb(0, 0, 0) border-collapse=collapse border-style=solid border-width=thick fo:block text-align=center color=rgb(256, 256, 256) fo:external-graphic src=url('file:D:\jakarta-tomcat-5.0.25\webapps\sbcs\jsps\images\advert_ch_hdr.jpg')//fo:block /fo:table-cell /fo:table-row /fo:table-body /fo:table fo:table table-layout=fixed fo:table-column column-width=5cm / fo:table-column column-width=4cm / fo:table-column column-width=4cm / fo:table-column column-width=5cm / fo:table-body fo:table-row height=1cm fo:table-cell display-align=center border-collapse=collapse border-style=solid border-width=thick fo:block text-align=centerfo:inline font-family=arialuni#32852;#36187;/fo:inline/fo:block /fo:table-cell fo:table-cell display-align=center border-collapse=collapse border-style=solid border-width=thick fo:block text-align=centerfo:inline font-family=arialuni#20027;#38431;/fo:inline/fo:block /fo:table-cell fo:table-cell display-align=center border-collapse=collapse border-style=solid border-width=thick fo:block text-align=centerfo:inline font-family=arialuni#23458;#38431
Re: Out of Memory problem
Thanks Chris, Would appreciate ifu can explain more how shall i increase memory in my case - I am on Tomcat server andusing servlet to render the fop. I am not using fop.bat file, Which script starts my JVM - really speaking i also do not know. My servlet.jar / fop.jar and related files are inside /WEB-INF/lib directory. I am compiling all files thr ant (all class path is set in CLASSPATH) How can i increase memoryso as to get correct font and pdf in my case? regards Manisha Chris Bowditch [EMAIL PROTECTED] wrote: Manisha Sathe wrote: I am trying for one Chinese PDF. When i do not make use of Arial Unicode MS font then i do not get this error. All chinese characters are displayed as #. Once i use this font then i get this error (even if it is just 2-3 pages long - sometimes at very beginning i get the 1 page report - after that even not that) I tried the the things mentined such as reduce the size of image, page sequence (do not know how to increase the JVM memory on fly) - also reset the Cache etc what ever given in docs, but still same.To increase JVM memory, just change your FOP.bat or whatever script starts your Java VM and specify command line parameter -Xmx256M. The default is 64Mb, which isnt sufficient due to the large number of glyphs in The Arial Unicode font.Chris-To unsubscribe, e-mail: [EMAIL PROTECTED]For additional commands, e-mail: [EMAIL PROTECTED]__Do You Yahoo!?Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com
Re: Out of Memory problem
(); for(int j = 0; j programCommandLine.length; ++j, ++i) { commandVector[i] = programCommandLine[j]; } // Log the action : for(i = 0; i commandVector.length; ++i) { if(i == 0) { s = commandVector[0]; } else { s += + commandVector[i]; } } System.out.println ( +++ Re-launch, heap= + available + Mb, requested= + needed + Mb, from directory + directory.getAbsolutePath() + , commandline= ); System.out.println(s); // Re-launch : i = launch(commandVector, directory); if(i 0) { System.out.println(*** RE-LAUNCH ATTEMPT FAILED.); } else { System.out.println(### End of re-launch.); } System.exit(i); } } /** * Executes an application and waits for completion. * p * For execution uwithout/u waiting see also bSy.execute()/b,BR * for execution with tethers (pipes) see also bSy.tether()/b.BR * uNOTE:/u a failing execution just returns b-1/b.p * A sample call is:BR * bresult = launch(new String[] { df, -k, fileName}, OUTPUT );/b/p * * @param commandVector Command line as array. * @param dir directory in which the process runs. * @return Exit status from the command. */ public int launch(String[] commandVector, File dir) { Process p; int exitValue = -1; if((p = execute(commandVector, dir)) != null) { try { exitValue = p.waitFor(); } catch(InterruptedException e) { exitValue = -1; } } return(exitValue); } /** * Executes an application in a directory, without waiting for it and returns the Process object. * * @param commandVector command line as String array. * @param dir directory in which the process runs. * @return Process object for the child process. */ public static Process execute(String[] commandVector, File dir) { Process p; try { p = Runtime.getRuntime().exec(commandVector, null, dir); } catch(IOException e) { p = null; } return(p); } /** * Returns a number of bytes as Mb, rounded up. * * @param m # of bytes * @return the # of Mb. */ public static long toMegaBytes(long m) { return((m / 1024 + 512) / 1024); } } /*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*/ /*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*/ On Thu, 24 Feb 2005 09:58:28 -0500, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Can we set the memory programmaticaly? Thanks Rohit Chris Bowditch [EMAIL PROTECTED] To: [EMAIL PROTECTED] otmail.com cc: Subject: Re: Out of Memory problem 02/24/2005 04:25 AM Please respond to fop-user Manisha Sathe wrote: I am trying for one Chinese PDF. When i do not make use of Arial Unicode MS font then i do not get this error. All chinese characters are displayed as #. Once i use this font then i get this error (even if it is just 2-3 pages long - sometimes at very beginning i get the 1 page report - after that even not that) I tried the the things mentined such as reduce the size of image, page sequence (do not know how to increase the JVM memory on fly) - also reset the Cache etc what ever given in docs, but still same. To increase JVM memory, just change your FOP.bat or whatever script starts your Java VM and specify command line parameter -Xmx256M. The default is 64Mb, which isnt sufficient due to the large number of glyphs in The Arial Unicode font. snip/ Chris - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Out of Memory problem
I am trying for one Chinese PDF. When i do not make use of Arial Unicode MS font then i do not get this error. All chinese characters are displayed as #. Once i use thisfont then i get this error (even if it is just 2-3 pages long - sometimes at very beginning i get the 1 page report - after that even not that) I tried the the things mentined such as reduce the size of image, page sequence (do not know how to increase the JVM memory on fly) - also reset the Cache etc what ever given in docs, but still same. The report is all full with chinese characters. On logger i do not see anything but on jsp page i getjava lang out of memory error. Is there any thing else which i can do here ? regards Manisha__Do You Yahoo!?Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com
Re: Out of Memory problem
Manisha Sathe wrote: I am trying for one Chinese PDF. When i do not make use of Arial Unicode MS font then i do not get this error. All chinese characters are displayed as #. Once i use this font then i get this error (even if it is just 2-3 pages long - sometimes at very beginning i get the 1 page report - after that even not that) I tried the the things mentined such as reduce the size of image, page sequence (do not know how to increase the JVM memory on fly) - also reset the Cache etc what ever given in docs, but still same. To increase JVM memory, just change your FOP.bat or whatever script starts your Java VM and specify command line parameter -Xmx256M. The default is 64Mb, which isnt sufficient due to the large number of glyphs in The Arial Unicode font. snip/ Chris - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Out of Memory problem
Can we set the memory programmaticaly? Thanks Rohit Chris Bowditch [EMAIL PROTECTED] To: [EMAIL PROTECTED] otmail.com cc: Subject: Re: Out of Memory problem 02/24/2005 04:25 AM Please respond to fop-user Manisha Sathe wrote: I am trying for one Chinese PDF. When i do not make use of Arial Unicode MS font then i do not get this error. All chinese characters are displayed as #. Once i use this font then i get this error (even if it is just 2-3 pages long - sometimes at very beginning i get the 1 page report - after that even not that) I tried the the things mentined such as reduce the size of image, page sequence (do not know how to increase the JVM memory on fly) - also reset the Cache etc what ever given in docs, but still same. To increase JVM memory, just change your FOP.bat or whatever script starts your Java VM and specify command line parameter -Xmx256M. The default is 64Mb, which isnt sufficient due to the large number of glyphs in The Arial Unicode font. snip/ Chris - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Out of Memory problem
I think someone asked this question ( inadvertently deleted that email) But how do we programmatically increase the memory size for FOP Java VM? Thanks Manoj Chris Bowditch [EMAIL PROTECTED]To: [EMAIL PROTECTED] otmail.com cc: Subject: Re: Out of Memory problem 02/24/2005 01:25 AM Please respond to fop-user Manisha Sathe wrote: I am trying for one Chinese PDF. When i do not make use of Arial Unicode MS font then i do not get this error. All chinese characters are displayed as #. Once i use this font then i get this error (even if it is just 2-3 pages long - sometimes at very beginning i get the 1 page report - after that even not that) I tried the the things mentined such as reduce the size of image, page sequence (do not know how to increase the JVM memory on fly) - also reset the Cache etc what ever given in docs, but still same. To increase JVM memory, just change your FOP.bat or whatever script starts your Java VM and specify command line parameter -Xmx256M. The default is 64Mb, which isnt sufficient due to the large number of glyphs in The Arial Unicode font. snip/ Chris - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Out of Memory problem
Manoj_Nair wrote: I think someone asked this question ( inadvertently deleted that email) But how do we programmatically increase the memory size for FOP Java VM? AFAIK, it must be done from the command-line. I don't know of a way to do this from within a Java program. Victor Mote - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]