diff options
Diffstat (limited to 'src/zenutil/cache')
| -rw-r--r-- | src/zenutil/cache/rpcrecording.cpp | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/zenutil/cache/rpcrecording.cpp b/src/zenutil/cache/rpcrecording.cpp index b8f9d65ef..5e00e8852 100644 --- a/src/zenutil/cache/rpcrecording.cpp +++ b/src/zenutil/cache/rpcrecording.cpp @@ -425,7 +425,7 @@ RecordedRequestsSegmentWriter::EndWrite() CbObjectWriter Cbo; Cbo << "time_start" << m_StartTime << "time_end" << m_EndTime << "duration" << Duration; Cbo << "segment_index" << m_SegmentIndex; - Cbo << "entry_count" << m_Entries.size() << "entry_size" << sizeof(RecordedRequest); + Cbo << "entry_count" << m_RequestCount << "entry_size" << sizeof(RecordedRequest); Cbo << "block_size" << RecordedRequestBlockSize << "standalone_threshold" << StandaloneFileSizeThreshold; Cbo.BeginObject("system_info"); @@ -446,7 +446,12 @@ RecordedRequestsSegmentWriter::EndWrite() std::error_code Ec; IndexFile.WriteAll(IndexBuffer, Ec); IndexFile.Close(); - m_Entries.clear(); + + // note that simply calling `.reset()` here will *not* release backing memory + // and it's important that we do because on high traffic servers this will use + // a lot of memory otherwise + std::vector<RecordedRequest> EmptyEntries; + swap(m_Entries, EmptyEntries); } uint64_t |