Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for removing doc handle from handleCache #380

Merged
merged 3 commits into from
Sep 11, 2024

Conversation

georgewsu
Copy link
Contributor

Summary:
Add support for removing doc handle from handleCache to free memory, without deleting document from storage.

Issue:
#330

Background:
After creating enough documents in a repo, out of memory errors will cause a synch server to crash because memory isn't being freed. Repo holds references to each DocHandle in handleCache and each DocHandle holds a reference to the automerge doc.

Next steps:
Once removeFromCache is added, it can be called from the Repo and/or synch server to free memory usage (that code must determine that the doc handle is safe to be removed from cache at that time).

@georgewsu georgewsu marked this pull request as ready for review August 28, 2024 00:18
@alexjg
Copy link
Contributor

alexjg commented Sep 11, 2024

This looks good but could you add a typedoc @experimental tag to the removeFromCache method as I think it's quite likely we'll change this API a bit before we're sure of how the cache eviction stuff should work.

@georgewsu
Copy link
Contributor Author

This looks good but could you add a typedoc @experimental tag to the removeFromCache method as I think it's quite likely we'll change this API a bit before we're sure of how the cache eviction stuff should work.

Sounds good, also added a check for documentId being present before proceeding to remove it.

@alexjg alexjg merged commit 3817343 into automerge:main Sep 11, 2024
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants