Binil Thomas
Binil Thomas

Reputation: 13809

Java profiler for Mac OS X which supports marking the heap

I want to know the number of extra objects created by processing a single request in my application.

I remember that OptimizeIt used to be able to do it. The steps, as I remember it were:

  1. Attach profiler to the application
  2. Run a small load on the server, so that all initialization activities happen
  3. "Force GC" from the profiler, which runs a full GC
  4. "Mark heap", so now we know the number of instances of each type in the heap
  5. Send one request to the server.
  6. The profiler shows what objects were created since the last "mark"
  7. "Force GC" again to see if any objects are lingering

OptimizeIt does not seem to be actively developed anymore (please correct me if I am wrong), and it does not seem to support Mac OS X.

Are there any other Java profilers for Mac OS X which support the scenario I outlined above?

Upvotes: 1

Views: 265

Answers (3)

Tomas Hurka
Tomas Hurka

Reputation: 6991

Take a look at Memory sampler from VisualVM and use it in 'Deltas' mode.

Upvotes: 0

Ingo Kegel
Ingo Kegel

Reputation: 48105

JProfiler can do that. You

  1. Attach to the running application
  2. Start recording allocations
  3. Perform your use case
  4. Take a heap snapshot and check "Select recorded objects" in the heap walker options dialog

Then the initial object set of the heap walker will only contain the strongly referenced objects that have been created by your use case.

Disclaimer: My company develops JProfiler

Upvotes: 1

Dave
Dave

Reputation: 4597

Take a peek at JVisualVM from Sun/Oracle. In its base configuration, I don't think it does what you need, but it has a number of plugins.

Upvotes: 0

Related Questions