Is there a way to query the ram footprint of a specific object in JRuby?
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
Have you heard about jmap, jhat, and visualvm?
jmap outputs the object memory maps / heap memory details for the given Java process.
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.
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.