[#4068] - JRVirtualization Memory leak

Bug report
Project: Severity:
Component: Reproducibility:
Assigned to:

I have a specific memory leak issue in Jasper Report . Can you help me to solve this problem ?

Our Production Scenario

1. We have a separate JVM instance which runs in multi threaded manner
2. Each thread wait a Jasper report request and execute it
3. Our report page size around 2000 page
4. We are using JRVirtualizer with the sub reports
5. Jasper Version used is 1.2.0

Issue Identified

1. When the JVM is restarted and for the first two hrs there is no issue
2. After two hrs time the performance of the report generation is drastically reduced
3. Finally it end up in out of memory or very slow process

Analysis Done so far

1. We had taken the head dump and analyze the memory usage at that point of time
2. The heap analyzer tool indicate the memory leak of 320 MB
3. Memory leak is coming from main object ‘DeleteOnExitHook’
4. It internally holding millions of HashMap object
5. Each of the HashMap object holding the JRVirtualizer temporary file name

I have also attached the screen shot for your reference

File jasperissue.rtf12.75 MB
kirubakaran.chandrasekar's picture
Joined: Jan 28 2015 - 12:14am
Last seen: 8 years 7 months ago


  • Assigned:nobody»

See the net.sf.jasperreports.virtualizer.files.delete.on.exit property. The doc (http://jasperreports.sourceforge.net/config.reference.html#net.sf.jasper...) says that the property has been available since 1.2.3, so it might not work in 1.2.0. That's a very old version anyway, you should consider upgrading.


  • Assigned:» anonymous

Hi, Here the problem not on the temp file not getting deleted. The temp filed are getting deleted properly from the file system. But it references are still help in the memory the under the object '‘DeletoeOnExitHook’. Please refer the heam dump analyzer attachment.

Order to correct the problem what should be the value set in the net.sf.jasperreports.virtualizer.files.delete.on.exit property


Setting the net.sf.jasperreports.virtualizer.files.delete.on.exit property to false might avoid the DeleteOnExitHook memory accumulation problem.


Hi Lucianc, Thanks for the information. I want to test this condition based upon your suggestion. Can you help me give the latest stable Jasper Version and how to download it for the testing purpose ?


Hi, how do I set this properly to false ? Is it through some property file setting ? Or I need to set this value as false in some object . Please provide more detail on this


The property is usually set in the JR configuration file called jasperreports.properties (which needs to be placed in a directory that's part of the application classpath).



The exact property name is

Am i right ?


No, the correct line is



Hi Lucianc, I have set this property as mentioned by you in the version 1.2.3. But still I am getting the same memory leak from DeleteOnExitHook. Please suggest what could have gone wrong here ? Please refer to the attached document for the details ....


File v1.2.3-memoryleak.rtf996.94 KB

Hi Lucianc, I have tried the same with the version 3.0. Still the memory leak is coming from the same class DeleteOnExitHook. Please suggest any other option we can try to resolve this issue ?



Please include a text field with the following expression in a report and run it in your application:


The text field should print false if net.sf.jasperreports.virtualizer.files.delete.on.exit=false is properly set.


Hi Lucinac,

When I add the property file in the classpath it is not working. But if i add it as system property with -D option then is working fine ....
Now in the heap dump I don't see any memory leak.
Thanks a lot for your valuable input in solving the issue.

One final question I have is, this problem reported only from beyond certain version JDK ?



Afaik the File.deleteOnExit() memory problem exists at least from JDK 1.4 (and up to 8).