aboutsummaryrefslogtreecommitdiff
path: root/zenstore/gc.cpp
diff options
context:
space:
mode:
authorStefan Boberg <[email protected]>2021-11-01 16:50:17 +0100
committerStefan Boberg <[email protected]>2021-11-01 16:50:17 +0100
commit2400d988796b952d65296e518944f505e9a91cb1 (patch)
tree77995a76525debced2686ba8ea610a9c7fa9752b /zenstore/gc.cpp
parentMerged from main (diff)
downloadzen-2400d988796b952d65296e518944f505e9a91cb1.tar.xz
zen-2400d988796b952d65296e518944f505e9a91cb1.zip
gc: CollectGarbage implementation
Diffstat (limited to 'zenstore/gc.cpp')
-rw-r--r--zenstore/gc.cpp17
1 files changed, 17 insertions, 0 deletions
diff --git a/zenstore/gc.cpp b/zenstore/gc.cpp
index cb03f72ff..3395761d6 100644
--- a/zenstore/gc.cpp
+++ b/zenstore/gc.cpp
@@ -110,6 +110,23 @@ CasGc::RemoveGcStorage(GcStorage* Storage)
void
CasGc::CollectGarbage()
{
+ RwLock::SharedLockScope _(m_Lock);
+
+ // First gather reference set
+
+ GcContext GcCtx;
+
+ for (GcContributor* Contributor : m_GcContribs)
+ {
+ Contributor->GatherReferences(GcCtx);
+ }
+
+ // Then trim storage
+
+ for (GcStorage* Storage : m_GcStorage)
+ {
+ Storage->CollectGarbage(GcCtx);
+ }
}
void