From 7efabba19cf6400bf9e707f53b40a6dd7110fafb Mon Sep 17 00:00:00 2001
From: Tobias Werth Memory tracking
startup flags to Bazel:
--host_jvm_args=-javaagent:$BAZEL/third_party/allocation_instrumenter/java-allocation-instrumenter-3.0.1.jar
--host_jvm_args=-javaagent:$BAZEL/third_party/allocation_instrumenter/java-allocation-instrumenter-3.3.0.jar
--host_jvm_args=-DRULE_MEMORY_TRACKER=1
- The java-agent is checked into bazel at
- third_party/allocation_instrumenter/java-allocation-instrumenter-3.0.1.jar, so make
- sure you adjust $BAZEL
for where you keep your bazel repository.
+ The java-agent is checked into Bazel at
+ third_party/allocation_instrumenter/java-allocation-instrumenter-3.3.0.jar, so make
+ sure you adjust $BAZEL
for where you keep your Bazel repository.
Do not forget to keep passing these options to Bazel for every command or the server will
restart.
Example:
- % bazel --host_jvm_args=-javaagent:$BAZEL/third_party/allocation_instrumenter/java-allocation-instrumenter-3.0.1.jar \ + % bazel --host_jvm_args=-javaagent:$BAZEL/third_party/allocation_instrumenter/java-allocation-instrumenter-3.3.0.jar \ --host_jvm_args=-DRULE_MEMORY_TRACKER=1 \ build --nobuild <targets> # Dump rules - % bazel --host_jvm_args=-javaagent:$BAZEL/third_party/allocation_instrumenter/java-allocation-instrumenter-3.0.1.jar \ + % bazel --host_jvm_args=-javaagent:$BAZEL/third_party/allocation_instrumenter/java-allocation-instrumenter-3.3.0.jar \ --host_jvm_args=-DRULE_MEMORY_TRACKER=1 \ dump --rules # Dump Starlark heap and analyze it with pprof - % bazel --host_jvm_args=-javaagent:$BAZEL/third_party/allocation_instrumenter/java-allocation-instrumenter-3.0.1.jar \ + % bazel --host_jvm_args=-javaagent:$BAZEL/third_party/allocation_instrumenter/java-allocation-instrumenter-3.3.0.jar \ --host_jvm_args=-DRULE_MEMORY_TRACKER=1 \ dump --skylark_memory=$HOME/prof.gz % pprof -flame $HOME/prof.gz diff --git a/src/main/java/com/google/devtools/build/lib/profiler/memory/AllocationTrackerModule.java b/src/main/java/com/google/devtools/build/lib/profiler/memory/AllocationTrackerModule.java index d0870d67a0647b..2c6034d137d9f1 100644 --- a/src/main/java/com/google/devtools/build/lib/profiler/memory/AllocationTrackerModule.java +++ b/src/main/java/com/google/devtools/build/lib/profiler/memory/AllocationTrackerModule.java @@ -36,7 +36,7 @@ *