47 , pool_gc_queue_(ops.gc_queue_size)
48 , period_(ops.gc_period.toSec())
56 pool_gc_thread_.join();
61 getGC()->
add(pool, deleter, deletable);
64 void SimpleGC::add(
void* pool, DeleteFunc deleter, IsDeletableFunc deletable)
69 i.is_deletable = deletable;
70 pool_gc_queue_.push(i);
75 typedef std::vector<PoolGCItem> V_PoolGCItem;
76 V_PoolGCItem gc_items;
83 MWSRQueue<PoolGCItem>::Node* it = pool_gc_queue_.popAll();
86 gc_items.push_back(it->val);
87 MWSRQueue<PoolGCItem>::Node* tmp = it;
89 pool_gc_queue_.free(tmp);
94 for (
size_t i = 0; i < gc_items.size();)
96 PoolGCItem& item = gc_items[i];
97 if (item.is_deletable(item.pool))
99 item.deleter(item.pool);
100 item = gc_items.back();
113 V_PoolGCItem::iterator it = gc_items.begin();
114 V_PoolGCItem::iterator end = gc_items.end();
115 for (; it != end; ++it)
120 ROS_WARN(
"Pool %p still has allocated blocks. Deleting anyway.", item.
pool);