[feature] (memory) Switch TLS mem tracker to separate more detailed memory usage (#8605)
In pr #8476, all memory usage of a process is recorded in the process mem tracker, and all memory usage of a query is recorded in the query mem tracker, and it is still necessary to manually call `transfer to` to track the cached memory size. We hope to separate out more detailed memory usage based on Hook TCMalloc new/delete + TLS mem tracker. In this pr, the more detailed mem tracker is switched to TLS, which automatically and accurately counts more detailed memory usage than before.
This commit is contained in:
@ -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/debug_util.h"
|
||||
#include "util/runtime_profile.h"
|
||||
|
||||
@ -52,6 +53,7 @@ Status CrossJoinNode::close(RuntimeState* state) {
|
||||
Status CrossJoinNode::construct_build_side(RuntimeState* state) {
|
||||
// Do a full scan of child(1) and store all build row batches.
|
||||
RETURN_IF_ERROR(child(1)->open(state));
|
||||
SCOPED_SWITCH_THREAD_LOCAL_MEM_TRACKER_ERR_CB("Cross join, while getting next from child 1");
|
||||
|
||||
while (true) {
|
||||
RowBatch* batch =
|
||||
@ -63,9 +65,6 @@ Status CrossJoinNode::construct_build_side(RuntimeState* state) {
|
||||
bool eos = false;
|
||||
RETURN_IF_ERROR(child(1)->get_next(state, batch, &eos));
|
||||
|
||||
// to prevent use too many memory
|
||||
RETURN_IF_INSTANCE_LIMIT_EXCEEDED(state, "Cross join, while getting next from the child 1.");
|
||||
|
||||
SCOPED_TIMER(_build_timer);
|
||||
_build_batches.add_row_batch(batch);
|
||||
VLOG_ROW << build_list_debug_string();
|
||||
|
||||
Reference in New Issue
Block a user