How to get the ram footprint of a specific object

2019-08-24 01:25发布

问题:

Is there a way to query the ram footprint of a specific object in JRuby?

回答1:

Have you heard about jmap, jhat, and visualvm?

  1. jmap outputs the object memory maps / heap memory details for the given Java process.

  2. jhat is a heap analysis tool that lets you create a Java heap dump, and then lets you query it using a SQL-like language to get more detail.

  3. visualvm is yet another Java tool for viewing details about a Java applications as they are running in the JVM.

I found this post from Charles Nutter to be very helpful in getting me started in JRuby profiling and memory inspection.



标签: jruby