Reduce memory pressure when decrypting large binary size#119
Reduce memory pressure when decrypting large binary size#119wingyplus wants to merge 2 commits intodanielberkompas:masterfrom
Conversation
Do not copying `message` to calculate tag length. This could reduce memory pressure during decode the tag.
|
ping @danielberkompas 🙇 |
|
@wingyplus Sorry for the long delay here. My prior role at my job didn't leave me with much energy for open source maintenance. I really appreciate all the charts and graphs showing the performance improvement here. Can you elaborate on the exact problem though? I know it's been awhile, so you may not remember the details at this point.
|
|
@danielberkompas Let me recall the situation ...😂 In my work, I used this library to encrypt the zip file that's contain a bunch of XML file. One day our production got crash, I start investigating, and found that it crash because of OOM while decrypting the zip file, the file size is ~115MB. |
|
Hi @danielberkompas, what else I need to do to get it merge? |
|
We've encountered memory exhaustion for large files (~100 MB file consuming >4 GB memory) during decryption. I tested this PR and confirmed that memory consumption is significantly reduced. |
|
We'd love to see this make it into a release. Is there anything I can do to help out? |
Hi,
I found memory pressure issues when encrypting ~200 MB bytes and decrypting it. Let me show reproduce steps:
First, setup vault in project:
Then open IEx shell and prepare encryption:
Open observer before decrypting ciphertext and decrypting it!:
Here is screen captures from observer:
Memory Usage:
Carrier Size:
All Allocator Types:
After tweak with this PR:
Memory Usage:
Carrier Size:
All Allocator Types:
The issue that I found is copy message that is converted to list during decoding tag. The code is not perfect, feel free to discuss.