users@glassfish.java.net

Re: How to get a memory snapshot

From: Tim Quinn <Timothy.Quinn_at_Sun.COM>
Date: Mon, 10 Nov 2008 16:41:04 -0600

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
>