[Feature](Memory) Hook TCMalloc new/delete automatically counts to MemTracker (#8476)

Early Design Documentation: https://shimo.im/docs/DT6JXDRkdTvdyV3G

Implement a new way of memory statistics based on TCMalloc New/Delete Hook,
MemTracker and TLS, and it is expected that all memory new/delete/malloc/free
of the BE process can be counted.
This commit is contained in:
Xinyi Zou
2022-03-20 23:06:54 +08:00
committed by GitHub
parent 276792daeb
commit eeae516e37
211 changed files with 1283 additions and 951 deletions

View File

@ -23,6 +23,7 @@
#include "gen_cpp/PlanNodes_types.h"
#include "runtime/row_batch.h"
#include "runtime/runtime_state.h"
#include "runtime/thread_context.h"
#include "util/runtime_profile.h"
namespace doris {
@ -69,7 +70,7 @@ Status BlockingJoinNode::prepare(RuntimeState* state) {
_probe_tuple_row_size = num_left_tuples * sizeof(Tuple*);
_build_tuple_row_size = num_build_tuples * sizeof(Tuple*);
_left_batch.reset(new RowBatch(child(0)->row_desc(), state->batch_size(), mem_tracker().get()));
_left_batch.reset(new RowBatch(child(0)->row_desc(), state->batch_size()));
return Status::OK();
}
@ -82,6 +83,7 @@ Status BlockingJoinNode::close(RuntimeState* state) {
}
void BlockingJoinNode::build_side_thread(RuntimeState* state, std::promise<Status>* status) {
SCOPED_ATTACH_TASK_THREAD(state, mem_tracker());
status->set_value(construct_build_side(state));
}