Search code examples
javawindowsmemoryjava-8jmap

jmap -histo with a specific object at Windows


While testing my jar application at Linux I use the command line below to track the usage/memory load of a specific object (eg JButton).

jmap -histo:live <pid> | grep JButton

Which results:

35:            24          11136  javax.swing.JButton
99:            31           2728  javax.swing.JButton$AccessibleJButton

Now I'm trying to do the same with Windows but I cannot find a similar command (like grep) to track a specific object. jmap -histo[:live] <pid> provides a full list of all objects. Does Windows have similar tools for such usage or an alternate way?


Solution

  • I tested the suggestions from comments and we have an answer now:

    jmap -histo:live <pid> | grep JButton
    

    from Linux is equivalent to:

    jmap -histo:live <pid> | find "JButton"
    

    or

    jmap -histo:live <pid> | findstr JButton
    

    from Windows.