diff options
| author | Stefan Boberg <[email protected]> | 2021-11-01 16:50:17 +0100 |
|---|---|---|
| committer | Stefan Boberg <[email protected]> | 2021-11-01 16:50:17 +0100 |
| commit | 2400d988796b952d65296e518944f505e9a91cb1 (patch) | |
| tree | 77995a76525debced2686ba8ea610a9c7fa9752b /zenstore/gc.cpp | |
| parent | Merged from main (diff) | |
| download | zen-2400d988796b952d65296e518944f505e9a91cb1.tar.xz zen-2400d988796b952d65296e518944f505e9a91cb1.zip | |
gc: CollectGarbage implementation
Diffstat (limited to 'zenstore/gc.cpp')
| -rw-r--r-- | zenstore/gc.cpp | 17 |
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 |