JpegLossless Compression Memory Issue

163 views
Skip to first unread message

Rahul Gulati

unread,
Jul 20, 2020, 9:32:45 AM7/20/20
to dcm4che
Hi,

We are facing memory leak issue while executing load of compression of uncompressed dicom instances to JpegLossless(1.2.840.10008.1.2.4.70) i.e. virtual memory keep on increasing and ultimately reaches the operating system limit causing the OS to kill the process. We have tested it with dcm4che version 5.19.1 as well as 5.22.3 but the issue persists.

And we also tried the compression load with JpegLsLossless (1.2.840.10008.1.2.4.80) and Jpeg2000Lossless (1.2.840.10008.1.2.4.90) but we didn't see any memory leak at all. So, it seems the issue is with JpegLossless.

We are using the default compression properties i.e. ImageReaderFactory.properties & ImageWriterFactory.properties. And we also tried with both ways of transcode i.e. legacy as well as new. Please find the attached source code for your reference.

And we also tried to locate the problematic area by using jemalloc(https://medium.com/swlh/native-memory-the-silent-jvm-killer-595913cba8e7) with dcm4che 5.19.1 version and found out that 99.5% (11.57 GB) of memory was getting allocated through native code cv::dicomJpgWrite. Please find attached jemalloc final output "out_jeprof.1303516.67.i67.heap".

Please suggest and let us know if any other information required.

Regards,
Rahul Gulati.

out_jeprof.1303516.67.i67.heap.gif
CompressionTranscode.java
CompressionLegacy.java

Nicolas Roduit

unread,
Jul 21, 2020, 3:28:55 PM7/21/20
to dcm4che
I managed to reproduce the problem and found that a delete was missing on a temporary object.

I open an issue and publish a fix.

Rahul Gulati

unread,
Jul 22, 2020, 6:09:48 AM7/22/20
to dcm4che
This is really great. Thank You for your efforts. 

Could You please also confirm if the issue is in JpegLossless decompression as well or not. 

And when can we expect the resolution to be available.

Regards,
Rahul

Nicolas Roduit

unread,
Jul 22, 2020, 6:56:10 AM7/22/20
to dcm4che
No, the issue was only during the compression.

Rahul Gulati

unread,
Jul 27, 2020, 1:32:26 PM7/27/20
to dcm4che
Although I can see in the dcm4che git repository that the fix is merged and I have also tested the change successfully but dcm4che maven repo is not updated i.e. I can still see the weasis.core.img.version property value as 4.3.0 instead of 4.4.0 at https://www.dcm4che.org/maven2/org/dcm4che/dcm4che-parent/5.22.4/dcm4che-parent-5.22.4.pom. Actually we are using nexus repo as maven repo which is not reflecting the updated dcm4che-parent pom in our build process.

Could You please help us on this.

Thank You. 

P.S: I have tested the change by manually changing the dcm4che-parent in my local maven repo.

Gunter Zeilinger

unread,
Jul 27, 2020, 1:45:23 PM7/27/20
to dcm...@googlegroups.com
Typically I upload to https://www.dcm4che.org/maven2/org/dcm4che when a version get released. The upload at 2020-07-14 was not intended.  So I removed it again.


Sent with ProtonMail Secure Email.

‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐
--
You received this message because you are subscribed to the Google Groups "dcm4che" group.
To unsubscribe from this group and stop receiving emails from it, send an email to dcm4che+u...@googlegroups.com.

Nicolas Roduit

unread,
Jul 27, 2020, 2:01:19 PM7/27/20
to dcm4che
Version 5.22.4 has not been released yet. This version should be 5.22.4-SNAPSHOT to comply with good versioning practices. The problem is that Nexus never modifies a release version by default while the snapshots are continuously updated.

Rahul Gulati

unread,
Jul 28, 2020, 8:38:07 AM7/28/20
to dcm4che
any idea when version 5.22.4 will release?

Gunter Zeilinger

unread,
Jul 28, 2020, 8:39:27 AM7/28/20
to dcm...@googlegroups.com
in 1-2 weeks.


Sent with ProtonMail Secure Email.

‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐
--
You received this message because you are subscribed to the Google Groups "dcm4che" group.
To unsubscribe from this group and stop receiving emails from it, send an email to dcm4che+u...@googlegroups.com.

Reply all
Reply to author
Forward
0 new messages