users@glassfish.java.net

Re: How to get a memory snapshot

From: Peter Williams <Pete.Williams_at_Sun.COM>
Date: Mon, 10 Nov 2008 15:06:47 -0800

I have to echo what Tim said -- I haven't used VisualVM much for this --
I use JMap + JHat + an external stack processing tool I wrote a few
years ago that strips out all the redundant data.

As for the Service vs. console -- Are you running on Vista? Is the
service running as a different user or with different privileges than
you are? My guess is that the OS is not allowing VisualVM access to the
process space.

Regardless, JMX should offer almost the same set of data -- I think the
profiling data will be missing, so if that is what you wanted, there you go.

-Peter

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
>