Skip to content

Commit a6e0eb8

Browse files
updated object pool with upper size
1 parent cd1e010 commit a6e0eb8

3 files changed

Lines changed: 6 additions & 4 deletions

File tree

benchmark/regression.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ def main():
129129

130130
plot.tight_layout()
131131
plot.savefig('result.png')
132-
plot.show()
132+
#plot.show()
133133
plot.close(fig)
134134

135135
# run the main entry

taskflow/core/executor.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -609,7 +609,7 @@ inline void Executor::_init_module_node(Node* node) {
609609
};
610610
}
611611

612-
// Procedure:
612+
// Procedure: _invoke
613613
inline void Executor::_invoke(unsigned me, Node* node) {
614614

615615
// Here we need to fetch the num_successors first to avoid the invalid memory

taskflow/utility/object_pool.hpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,10 @@ std::unique_ptr<T> ObjectPool<T>::destack(ArgsT&&... args) {
7474
// Procedure: enstack
7575
template <typename T>
7676
void ObjectPool<T>::enstack(std::unique_ptr<T>&& obj) {
77-
obj->recycle();
78-
_stack.push_back(std::move(obj));
77+
if(_stack.size() < 4096) {
78+
obj->recycle();
79+
_stack.push_back(std::move(obj));
80+
}
7981
}
8082

8183
} // end of namespace tf -----------------------------------------------------

0 commit comments

Comments
 (0)