commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Stefan Bodewig (JIRA)" <>
Subject [jira] [Commented] (COMPRESS-473) Avoiding Java native peer objects that override finalize()
Date Wed, 28 Nov 2018 20:45:00 GMT


Stefan Bodewig commented on COMPRESS-473:

In a way we implement {{Inflater}} ourselves in pure Java in the deflate64 package and it
is orders of magnitude slower than the zlib based one. In this case the cure is probably worse
than the illness. 

Replacing them {{Deflater}}/{{Inflater}} is non-trivial and likely platform dependent.

As long as there is no native replacement for {{Deflater}}/{{Inflater}} we can't replace {{Gzip*stream}}
classes either as any replacement would still need {{Deflater}}/{{Inflater}}. We don't use
{{ZipOutputStream}}/{{ZipInputStream}} at all.

> Avoiding Java native peer objects that override finalize()
> ----------------------------------------------------------
>                 Key: COMPRESS-473
>                 URL:
>             Project: Commons Compress
>          Issue Type: Improvement
>            Reporter: Roman Leventov
>            Priority: Major
> Objects that override finalize() are very bad for GC. The infrastructure library such
as Commons Compress is probably the right place to do the hard work of eliminating dependencies
on such objects. Instead, PhantomReference registered in a Queue, or sun.misc.Cleaner (or
java.lang.ref.Cleaner) should be used.
> In particular:
should not be used.
> The issue for Zstd created in a downstream library: []
> Some other downstream dependencies could be affected too.
> Commons Compress's own ZipFile and BZip2CompressorOutputStream classes should not override
finalize() too.

This message was sent by Atlassian JIRA

View raw message