Clean up cached frames that exceed the number in our max_bytes variable
| 248 | |
| 249 | // Clean up cached frames that exceed the number in our max_bytes variable |
| 250 | void CacheMemory::CleanUp() |
| 251 | { |
| 252 | // Do we auto clean up? |
| 253 | if (max_bytes > 0) |
| 254 | { |
| 255 | // Create a scoped lock, to protect the cache from multiple threads |
| 256 | const std::lock_guard<std::recursive_mutex> lock(*cacheMutex); |
| 257 | |
| 258 | while (GetBytes() > max_bytes && frame_numbers.size() > 20) |
| 259 | { |
| 260 | // Get the oldest frame number. |
| 261 | int64_t frame_to_remove = frame_numbers.back(); |
| 262 | |
| 263 | // Remove frame_number and frame |
| 264 | Remove(frame_to_remove); |
| 265 | } |
| 266 | } |
| 267 | } |
| 268 | |
| 269 | |
| 270 | // Generate JSON string of this object |
nothing calls this directly
no outgoing calls
no test coverage detected