Skip to content

Commit

Permalink
print dump
Browse files Browse the repository at this point in the history
  • Loading branch information
zhztheplayer committed Aug 21, 2024
1 parent be35d57 commit ee826b4
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 ee826b4

Please sign in to comment.