Apache batik memory issues

Hilbert Mostert <[email protected]>
Newsgroups gmane.text.xml.batik.user
Message-ID <[email protected]>
Hello All,


Recently I have started using Apache Batik to create PDF files from SVG 
templates. The application is used to generate exam pages for students. 
It works great but it uses a huge amount of memory. This is sometimes 
annoying because i have to increase the memory limit to over 4Gb to have 
it complete the task. There are in general lots of students (500+) and 
in one case 2000+ students. This will, of course, eat memory like an 
elephant I accept that.

I want to reduce this memory footprint and have found one issue in my 
program where I need help with.

I am using the Java JRE 1.6.0_32, Batik 1.7 and PDFBox 1.6.0.

The program has the following flow:

1.    fetch students from source (Excel file)
2.    create workers to generate pdf from svg
3.    while not all students have been processed do
3.1      replace information in svg document ( using w3c functions from 
Document class  ) (this is done by worker)
3.2      generate PDF from svg document (Using PDFTranscoder)
3.3      check if there are more students; true: goto 3.1; false: 
continue with step 4
4.   clean up workers
5.   generate single pdf from all generated pdfs using PDFBox
6.   done

It is a multi threaded environment and all the workers are in their own 
thread, each worker has a copy of the svg document, they dont share 
anything (for obvious reasons).

What I have found  is what comes after step 4, after cleaning up the 
workers I am still using 1Gb of memory which is much more than when I 
start (around 128Mb). I suspect there is some caching here and there but 
I have not enough knowledge from batik to fix this problem.

Who can help me or has the answer for me?


Thanks in advance,

Hilbert Mostert
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.