aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Engelbrecht <[email protected]>2022-03-29 16:58:24 +0200
committerDan Engelbrecht <[email protected]>2022-03-29 16:58:24 +0200
commit1e8884edd62c574e6fca7ed815edf504fc3f5ea3 (patch)
treed4ae6eb8b884a3606f93d142a18717082aea262f
parentMerge branch 'main' of https://github.com/EpicGames/zen (diff)
downloadzen-1e8884edd62c574e6fca7ed815edf504fc3f5ea3.tar.xz
zen-1e8884edd62c574e6fca7ed815edf504fc3f5ea3.zip
Clear gathered Cid array periodically and add just the new ones
-rw-r--r--zenserver/cache/structuredcachestore.cpp9
1 files changed, 6 insertions, 3 deletions
diff --git a/zenserver/cache/structuredcachestore.cpp b/zenserver/cache/structuredcachestore.cpp
index de5bccc3a..66f32c858 100644
--- a/zenserver/cache/structuredcachestore.cpp
+++ b/zenserver/cache/structuredcachestore.cpp
@@ -773,7 +773,7 @@ ZenCacheDiskLayer::CacheBucket::GatherReferences(GcContext& GcCtx)
return Entry.LastAccess < Ticks;
});
- Cids.reserve(Entries.size());
+ Cids.reserve(1024);
for (auto Kv = ValidIt; Kv != Entries.end(); ++Kv)
{
@@ -791,10 +791,13 @@ ZenCacheDiskLayer::CacheBucket::GatherReferences(GcContext& GcCtx)
if (CacheValue.Value)
{
ZEN_ASSERT(CacheValue.Value.GetContentType() == ZenContentType::kCbObject);
-
+ if (Cids.size() > 1024)
+ {
+ GcCtx.ContributeCids(Cids);
+ Cids.clear();
+ }
CbObject Obj(SharedBuffer{CacheValue.Value});
Obj.IterateAttachments([&Cids](CbFieldView Field) { Cids.push_back(Field.AsAttachment()); });
- GcCtx.ContributeCids(Cids);
}
}
}