Le 09/08/2013 10:17, FL a écrit :
Hello,In my application Java, I have a tool of migration which allows me to push towards CouchDB (No-SQL DB) in JSON (Jackon), XML(JAXB), and PDF format corresponding to these folders (POJOs/Object Java). In the 500th iteration (approximately) the memory PermGen is saturated, and the JVM is blocked(surrounded). It is necessarily necessary to restart the JBoss server ... We analyzed the evolution of the memory with JConsole (of the jdk) and also JProfiler 8 => leak og PermGen memory ... It would seem that JOpenDocument is not adapted in batch processing.
Well, jOpenDocument has been used in production for many years, with long running processes and we never saw an OutOfMemoryError.
Here is a result of our UnitTest : *The unit test :* @Test public void testDeCharge() throws DouaneException, JDOMException, TemplateException, IOException {
.....
}
This doesn't give more information about your problem. And since it's incomplete no one can try to replicate your problem. I've attached a test, when I run it in jProfiler no objects of jOpenDocument remains in memory at the end (except some static constants) and the total JVM memory is 1.1 MB.
*The console output : * java.lang.OutOfMemoryError: PermGen space at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1205) at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:522) at org.jdom.input.SAXBuilder.build(SAXBuilder.java:518) at org.jdom.input.SAXBuilder.build(SAXBuilder.java:865) at org.jopendocument.dom.ODPackage$1.processEntry(Unknown Source) at org.jopendocument.util.ZippedFilesProcessor.process(Unknown Source) at org.jopendocument.dom.ODPackage.<init>(Unknown Source) at org.jopendocument.dom.template.Template.<init>(Unknown Source) at org.jopendocument.dom.template.RhinoStreamTemplate.<init>(Unknown Source) at fr.gouv.finances.douane.banaco.edition.dossier.DossierExAnteEdition.getSelectedTemplate(DossierExAnteEdition.java:45) at fr.gouv.finances.douane.banaco.edition.dossier.DossierEdition.editer(DossierEdition.java:214) at fr.gouv.finances.douane.banaco.edition.dossier.DossierTest.testDeCharge(DossierTest.java:124)
There's RhinoStreamTemplate in your stack trace, meaning you don't use jOpenDocument 1.3 but an older one. Also the part where the JRE runs out of memory and the part that's causing the leak may not be the same.
Heve you an idea ?
You could either provide a minimal runnable sample of your code exhibiting the leak. Or since the code is apparently for the french customs and might need the commercial licence, buy one.
Cheers, Sylvain ----- You received this message because you are subscribed to the Google Groups "jOpenDocument" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jopendocument+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
/* * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. * * Copyright 2008 jOpenDocument, by ILM Informatique. All rights reserved. * * The contents of this file are subject to the terms of the GNU General Public License Version 3 * only ("GPL"). You may not use this file except in compliance with the License. You can obtain a * copy of the License at http://www.gnu.org/licenses/gpl-3.0.html See the License for the specific * language governing permissions and limitations under the License. * * When distributing the software, include this License Header Notice in each file. */ package org.jopendocument.sample; import java.io.File; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import org.jopendocument.dom.OOUtils; import org.jopendocument.dom.template.EngineTemplate; import org.jopendocument.dom.template.RhinoTemplate; public class TestTemplate { public static void main(String[] args) { try { File templateFile = new File("template/test.odt"); File outFile = new File("out.odt"); final List<Map<String, String>> months = new ArrayList<Map<String, String>>(); months.add(createMap("January", "-12", "3")); months.add(createMap("February", "-8", "5")); months.add(createMap("March", "-5", "12")); months.add(createMap("April", "-1", "15")); months.add(createMap("May", "3", "21")); for (int i = 0; i < 200; i++) { // Load the template. EngineTemplate template = new RhinoTemplate(templateFile); // Fill with sample values. template.setField("toto", "value set using setField()"); template.setField("months", months); template.hideParagraph("p1"); template.hideSection("section1"); // Save to file. template.saveAs(outFile); } // Open the document with OpenOffice.org ! OOUtils.open(outFile); } catch (Exception e) { e.printStackTrace(); } } private static Map<String, String> createMap(String n, String min, String max) { final Map<String, String> res = new HashMap<String, String>(); res.put("name", n); res.put("min", min); res.put("max", max); return res; } }
test.odt
Description: application/vnd.oasis.opendocument.text