Dump tcmalloc heap stat.
diff --git a/heron/stmgr/src/cpp/BUILD b/heron/stmgr/src/cpp/BUILD
index a726c59..d5cffe7 100644
--- a/heron/stmgr/src/cpp/BUILD
+++ b/heron/stmgr/src/cpp/BUILD
@@ -131,6 +131,7 @@
"//heron/statemgrs/src/cpp:statemgrs-cxx",
"//third_party/yaml-cpp:yaml-cxx",
"//third_party/gperftools:profiler-cxx",
+ "//third_party/gperftools:tcmalloc-cxx",
],
linkstatic = 1,
)
diff --git a/heron/stmgr/src/cpp/manager/stmgr.cpp b/heron/stmgr/src/cpp/manager/stmgr.cpp
index aad0d63..363f700 100644
--- a/heron/stmgr/src/cpp/manager/stmgr.cpp
+++ b/heron/stmgr/src/cpp/manager/stmgr.cpp
@@ -15,6 +15,7 @@
*/
#include "manager/stmgr.h"
+#include <gperftools/malloc_extension.h>
#include <sys/resource.h>
#include <cstdlib>
#include <iostream>
@@ -110,6 +111,15 @@
// Create and Register Tuple cache
CreateTupleCache();
+ // Output heap stat every 1 min
+ CHECK_GT(eventLoop_->registerTimer(
+ [](EventLoop::Status) {
+ char buffer[4096];
+ MallocExtension::instance()->GetStats(buffer, 4096);
+ LOG(INFO) << buffer;
+ }, true, 60_s),
+ 0);
+
// Check for log pruning every 5 minutes
CHECK_GT(eventLoop_->registerTimer(
[](EventLoop::Status) { ::heron::common::PruneLogs(); }, true,