387752 {
387753 auto tag_idx = (
idx_t)tag;
387754 if ((
idx_t)AbsValue(size) < MEMORY_USAGE_CACHE_THRESHOLD) {
387755
387756
387757
387758
387761 auto new_tag_size = cache[tag_idx].fetch_add(size, std::memory_order_relaxed) +
size;
387762 if ((
idx_t)AbsValue(new_tag_size) >= MEMORY_USAGE_CACHE_THRESHOLD) {
387763
387764 auto tag_size = cache[tag_idx].exchange(0, std::memory_order_relaxed);
387765 memory_usage[tag_idx].fetch_add(tag_size, std::memory_order_relaxed);
387766 }
387767 auto new_total_size = cache[TOTAL_MEMORY_USAGE_INDEX].fetch_add(size, std::memory_order_relaxed) +
size;
387768 if ((
idx_t)AbsValue(new_total_size) >= MEMORY_USAGE_CACHE_THRESHOLD) {
387769
387770 auto total_size = cache[TOTAL_MEMORY_USAGE_INDEX].exchange(0, std::memory_order_relaxed);
387771 memory_usage[TOTAL_MEMORY_USAGE_INDEX].fetch_add(total_size, std::memory_order_relaxed);
387772 }
387773 } else {
387774
387775 memory_usage[tag_idx].fetch_add(size, std::memory_order_relaxed);
387776 memory_usage[TOTAL_MEMORY_USAGE_INDEX].fetch_add(size, std::memory_order_relaxed);
387777 }
387778}
static idx_t GetEstimatedCPUId()
Definition duckdb.cpp:335387
GOpaque< Size > size(const GMat &src)
static constexpr idx_t MEMORY_USAGE_CACHE_COUNT
The maximum difference between memory statistics and actual usage is 2MB (64 * 32k).
Definition duckdb.cpp:114003