diff --git a/be/src/util/runtime_profile.cpp b/be/src/util/runtime_profile.cpp index 13962b5433176..2d3a2b50ead33 100644 --- a/be/src/util/runtime_profile.cpp +++ b/be/src/util/runtime_profile.cpp @@ -746,13 +746,10 @@ void RuntimeProfile::to_thrift(TRuntimeProfileTree* tree) { } void RuntimeProfile::to_thrift(std::vector* nodes) { - nodes->reserve(nodes->size() + _children.size()); - int index = nodes->size(); nodes->emplace_back(); TRuntimeProfileNode& node = (*nodes)[index]; node.name = _name; - node.num_children = _children.size(); node.metadata = _metadata; node.indent = true; @@ -810,6 +807,8 @@ void RuntimeProfile::to_thrift(std::vector* nodes) { std::lock_guard l(_children_lock); children = _children; } + node.num_children = children.size(); + nodes->reserve(nodes->size() + children.size()); for (auto& i : children) { int child_idx = nodes->size();