| 2423 | } |
| 2424 | |
| 2425 | void |
| 2426 | HGraph::cal_memory_usage() { |
| 2427 | auto memory = sizeof(HGraph); |
| 2428 | memory += this->neighbors_mutex_->GetMemoryUsage(); |
| 2429 | memory += this->pool_->GetMemoryUsage(); |
| 2430 | memory += this->label_table_->GetMemoryUsage(); |
| 2431 | memory += this->basic_flatten_codes_->GetMemoryUsage(); |
| 2432 | memory += this->bottom_graph_->GetMemoryUsage(); |
| 2433 | for (auto& graph : this->route_graphs_) { |
| 2434 | memory += graph->GetMemoryUsage(); |
| 2435 | } |
| 2436 | if (use_reorder_) { |
| 2437 | memory += this->high_precise_codes_->GetMemoryUsage(); |
| 2438 | } |
| 2439 | |
| 2440 | if (this->extra_infos_ != nullptr and this->extra_info_size_ > 0) { |
| 2441 | memory += this->extra_infos_->GetMemoryUsage(); |
| 2442 | } |
| 2443 | |
| 2444 | if (this->create_new_raw_vector_ and this->raw_vector_ != nullptr) { |
| 2445 | memory += raw_vector_->GetMemoryUsage(); |
| 2446 | } |
| 2447 | |
| 2448 | std::unique_lock lock(this->memory_usage_mutex_); |
| 2449 | this->current_memory_usage_.store(static_cast<int64_t>(memory)); |
| 2450 | } |
| 2451 | |
| 2452 | } // namespace vsag |
no test coverage detected