users@glassfish.java.net

Re: How to get a memory snapshot

From: Ryan de Laplante <ryan_at_ijws.com>
Date: Mon, 10 Nov 2008 18:16:09 -0500

Earlier I used jmap to create my heap dumps and NetBeans Heap Analyzer
to dig through them... but I find it quite useless since it is 300 MB
and I don't see any obvious sign of my program having a leak. I want to
diff two heap dumps. I know NetBeans and VisualVM have a feature to
compare snapshots, but it won't take two heap dumps. I will ask the
NetBeans users mailing list how to do this, or look in the docs first.

Thanks,
Ryan


Tim Quinn wrote:
> Hi, Ryan.
>
> Have you tried using jmap to capture the heap dump(s) and then analyze
> them? I'm not experienced in using NetBeans to compare two dumps but
> it (at least the copy of 6.5 rc2 I have on my system) seems to be able
> to load them. Because jmap should come with the Java runtime you
> should be able to use it whether NB is on the same system as GlassFish
> or not.
>
> Just a thought.
>
> - Tim
>
> Ryan de Laplante wrote:
>> I'm using JDK 6 update 7. When I run GlassFish as a Windows
>> service, the only way I can get VisualVM to connect to it is using
>> JMX, and the profiler tab is not visible.
>>
>> If I shut down the windows service and start GlassFish from the
>> command prompt, VisualVM shows a GlassFish tree node and I can use
>> the profiler with it. If I connect to GlassFish using JMX, the
>> profiler tab is visible.
>> Anyway the profiler doesn't seem to be able to attach itself to a
>> running GlassFish instance. I let it try for about 20 minutes
>> before stopping it. Do you know how to capture what NetBeans needs to
>> do a compare of two heap dumps? NetBeans is not on the production
>> server. I want to use some tool to capture the data.
>>
>>
>> Thanks,
>> Ryan
>>
>>
>>
>> Peter Williams wrote:
>>> Ryan de Laplante wrote:
>>>> I'm trying to use NetBeans to compare two heap dumps taken seconds
>>>> apart to help me find a memory leak. The heapdumps are of
>>>> GlassFish with my app running inside. I took them using
>>>> VisualVM. VisualVM did not detect the GlassFish running as a
>>>> windows service, so I had to connect to it using JMX.
>>> Odd. Are you running GlassFish on JDK 5 or JDK 6? You'll get
>>> better results if running on JDK 6 as VisualVM will use the profiler
>>> api's available in that version. IIRC, what you describe is what
>>> will happen if you are running on JDK 5.
>>>> I think I lose a lot of VisualVM features when doing that.
>>> I don't think this is necessarily true. But see above, re: JDK 5.
>>>
>>> -Peter
>>>>
>>>> Anyway, NetBeans doesn't seem to let me compare two heap dumps, it
>>>> wants Profiler Snapshots (.nps files). Any idea how I can do this
>>>> with GlassFish running as a Windows service? Maybe I need to stop
>>>> the server and start it from the command prompt so that Visual VM
>>>> can attach to it.
>>>>
>>>>
>>>> Thanks,
>>>> Ryan
>>>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe_at_glassfish.dev.java.net
>> For additional commands, e-mail: users-help_at_glassfish.dev.java.net
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_glassfish.dev.java.net
> For additional commands, e-mail: users-help_at_glassfish.dev.java.net
>
>