lifetime policy
| 67 | |
| 68 | // lifetime policy |
| 69 | LifetimePolicy* MemoryPlanner::BestLifetimePolicy() { |
| 70 | LifetimePolicy* best_policy = nullptr; |
| 71 | auto total_mem = std::numeric_limits<size_t>::max(); |
| 72 | for (auto policy : lifetime_stats_polices_) { |
| 73 | auto policy_mem = policy->TotalMem(); |
| 74 | if (policy_mem < total_mem) { |
| 75 | best_policy = policy; |
| 76 | total_mem = policy_mem; |
| 77 | } |
| 78 | } |
| 79 | // LOG(INFO_DEV) << "MemoryPlanner's best lifetime policy consume Memory:" |
| 80 | // << total_mem; |
| 81 | return best_policy; |
| 82 | } |
| 83 | |
| 84 | void MemoryPlanner::Reset() { |
| 85 | counter_ = 0; |