[compression] must call .end() on Inflater/Deflater

Merged
#11 · Created  · Last updated

Merged pull request

Merged in esiqveland/jose4j/bugfix_memory_leak (pull request #11)

f58064a·Author: ·Closed by: ·2017-09-20

Description

This fixes memory leak in compression for jose4j.

When providing an Inflater/Deflater to a *OutputStream, it is the callers responsibility to cleanup after use.

When created, Inflater/Deflater calls into zlib and allocates a small amount of memory, which will only get released after .end() is called. This memory is off-heap, allocated in a C-library, so it will not show up in the JVM, making for a subtle increase over time.

Our service was gradully accumulating memory. Over 3 days it would consume 80GB of memory, with the JVM heap only at ~4GB. I tracked it down to this library by looking at the strings found in the heap dump looking like jwt strings.

With this change, the service has now been running 2 days and still at 5GB memory total.

0 attachments

0 comments

Loading commits...