Skip to content

Commit

Permalink
[GLUTEN-6930][VL] Print memory statistics during task ending when lea…
Browse files Browse the repository at this point in the history
…k is found
  • Loading branch information
zhztheplayer authored Aug 21, 2024
1 parent 371d448 commit 4884764
Showing 1 changed file with 12 additions and 10 deletions.
22 changes: 12 additions & 10 deletions gluten-data/src/main/scala/org/apache/gluten/runtime/Runtime.scala
Original file line number Diff line number Diff line change
Expand Up @@ -97,16 +97,17 @@ object Runtime {
throw new GlutenException(
s"Runtime instance already released: $handle, ${resourceName()}, ${priority()}")
}

def dump(): KnownNameAndStats = {
new KnownNameAndStats() {
override def name: String = resourceName()
override def stats: MemoryUsageStats = collectMemoryUsage()
}
}

if (LOGGER.isDebugEnabled) {
LOGGER.debug(
SparkMemoryUtil.prettyPrintStats(
"About to release memory manager, usage dump:",
new KnownNameAndStats() {
override def name: String = resourceName()

override def stats: MemoryUsageStats = collectMemoryUsage()
}
))
SparkMemoryUtil.prettyPrintStats("About to release memory manager, usage dump:", dump()))
}

RuntimeJniWrapper.releaseRuntime(handle)
Expand All @@ -115,10 +116,11 @@ object Runtime {
LOGGER.warn(
String.format(
"%s Reservation listener %s still reserved non-zero bytes, which may cause memory" +
" leak, size: %s. ",
" leak, size: %s, dump: %s ",
name,
rl.toString,
SparkMemoryUtil.bytesToString(rl.getUsedBytes)
SparkMemoryUtil.bytesToString(rl.getUsedBytes),
dump()
))
}
}
Expand Down

0 comments on commit 4884764

Please sign in to comment.