Skip to content
This repository was archived by the owner on May 6, 2025. It is now read-only.

AN-8945: Call reset() to delete ByteStream in ResourceStream #314

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from

Conversation

ZakHsieh
Copy link

@ZakHsieh ZakHsieh commented Jun 6, 2018

Original implementation will cause huge memory leakages when Java layer acquire a resource, the ByteStream is never been released due to calling release() won't delete the memory allocation.
I'd change the _ptr.release() to _ptr.reset() to unlink the pointer and release the memory of ByteStream.

@danielweck
Copy link
Member

Although I have not tested this code change myself, I provided technical details in this reply to the original Pull Request:
#307 (comment)
As you can see, my preferred solution is the same as the one @ZakHsieh proposes in this Pull Request, so I personally approve this PR in principle (again, untested code at my end, but high degree of confidence that this works, especially as this is in production at @ZakHsieh 's company).
@rkwright feel free to merge if you consider this a consensus :)

M9915018 added a commit to M9915018/readium-sdk that referenced this pull request Apr 6, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants