[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

@ -824,7 +824,7 @@ void Expr::assign_fn_ctx_idx(int* next_fn_ctx_idx) {
Status Expr::create(const TExpr& texpr, const RowDescriptor& row_desc, RuntimeState* state,
ObjectPool* pool, Expr** scalar_expr) {
*scalar_expr = nullptr;
Expr* root;
Expr* root = nullptr;
RETURN_IF_ERROR(create_expr(pool, texpr.nodes[0], &root));
RETURN_IF_ERROR(create_tree(texpr, pool, root));
// TODO pengyubing replace by Init()
@ -848,7 +848,7 @@ Status Expr::create(const std::vector<TExpr>& texprs, const RowDescriptor& row_d
RuntimeState* state, ObjectPool* pool, std::vector<Expr*>* exprs) {
exprs->clear();
for (const TExpr& texpr : texprs) {
Expr* expr;
Expr* expr = nullptr;
RETURN_IF_ERROR(create(texpr, row_desc, state, pool, &expr));
DCHECK(expr != nullptr);
exprs->push_back(expr);