Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Scala + HeapStats
$ rpm -qa | grep java-1.8.0-openjdk
java-1.8.0-openjdk-1.8.0.60-14.b27.fc22.x86_64
java-1.8.0-openjdk-debuginfo-1.8.0.60-14.b27.fc22.x86_64
java-1.8.0-openjdk-headless-1.8.0.60-14.b27.fc22.x86
$ rpm -qa | grep heapsatts
heapstats_agent-1.1.3-0.fc22.x86_64
$ scalac HelloWorld.scala
$ scala -J-agentlib:heapstats HelloWorld
heapstats INFO: heapstats_agent 1.1.3
heapstats INFO: Supported processor features: SSE2
heapstats INFO: Agent Attach Enable = true
heapstats INFO: SnapShot FileName = heapstats_snapshot.dat
heapstats INFO: Heap Log FileName = heapstats_log.csv
heapstats INFO: Archive FileName = heapstats_analyze.zip
heapstats INFO: LogLevel = Info
heapstats INFO: ReduceSnapShot = true
heapstats INFO: Trigger on FullGC = true
heapstats INFO: Trigger on DumpRequest = true
heapstats INFO: Log Trigger on Error = true
heapstats INFO: Log Trigger on Signal = true
heapstats INFO: Log Trigger on Deadlock = true
heapstats INFO: RankingOrder = DELTA
heapstats INFO: RankLevel = 5
heapstats INFO: AlertPercentage = 50 ( 119537664 bytes )
heapstats INFO: Java heap usage alert percentage = 95 ( 216 MB )
heapstats INFO: Metaspace usage alert is DISABLED.
heapstats INFO: Interval SnapShot is DISABLED.
heapstats INFO: Log interval = 300 sec
heapstats INFO: First Collect log = true
heapstats INFO: Normal logging signal is DISABLED.
heapstats INFO: All logging signal = USR2
heapstats INFO: Reload signal = HUP
heapstats INFO: SNMP send = true
heapstats INFO: SNMP target = localhost
heapstats INFO: SNMP community = public
heapstats INFO: Log dirictory = ./tmp
heapstats INFO: Archive command = "/usr/bin/zip %archivefile% -jr %logdir%"
heapstats INFO: Kill on Error = false
Hello, world!
object HelloWorld {
def main(args: Array[String]) {
println("Hello, world!")
}
}
@ykubota

This comment has been minimized.

Copy link
Owner Author

ykubota commented Oct 14, 2015

import scala.collection.mutable.ListBuffer
object Main {
  def main(args: Array[String]) {
    val buf: ListBuffer[Int] = ListBuffer(1, 2, 3)
    while (true) {
      buf += 10
      //Thread.sleep(10)
    }
 }
}

$ scala -J-agentlib:heapstats Main.scala

image
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.