users@glassfish.java.net

Re: How to get a memory snapshot

From: Ryan de Laplante <ryan_at_ijws.com>
Date: Mon, 10 Nov 2008 17:27:01 -0500

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
>>