Previous Topic

Next Topic

Book Contents

Book Index

Examining Created Objects

The Objects view is not shown by default when launching mBProfiler in Eclipse. You can open the view by clicking Window > Show View > Objects from the main menu bar in the mBProfiler perspective.

To have data shown, memory profiling must be turned on – either from this view or from another one related to memory: Memory Call Tree, Classes, Memory Hot Spots or Bundles Memory Call Tree. Object information is regularly updated without the need of stopping memory profiling.

Objects Table

The information on the created objects is arranged in a table. You can add and remove columns from the Columns mBProfiler preferences, or from the Choose Columns option of the pop-up menu.

Columns

Description

class

The name of the class as a root node and the objects emerging from it as sub-nodes. If there are several Class objects with the same name created from different loaders in a profiled an OSGi runtime, e.g. if a bundle is re-installed a few times, mBProfiler will add sequence numbers next to the symbolic name of repeating nodes, e.g. my.bundle.Demo (2).

package

The package to which the class belongs. If not shown and the Show qualified names mBProfiler preference is on, its value is added to the class column.

class loader

The name of the class loader, which has loaded the correspondent class.

  • In case of conventional Java class loaders, this is its class name.
  • In case of class loaders residing in an OSGi environment, this is the symbolic name of the bundle the loader is for. If there are many loaders for the same bundle (e.g. the bundle has been re-installed a few times), repeating entries have sequence numbers next to the symbolic name, e.g. my.bundle (2).

size

The total number of bytes that the corresponding class instances currently have allocated in the memory.

alloc number

The allocation number of the instance given by mBProfiler when the JVM sends an event for object allocation. It shows the order in time in which the objects were created.

timestamp

The time in milliseconds of the object's creation relatively to the mBProfiler's startup.

thread

The thread that has instantiated the object.

method

The exact place of the class instantiation in the source code:

  • First is the class name. If the Show qualified names mBProfiler preference is on, only the fully-qualified class name is shown. Otherwise, only the name of the class is included.
  • Second is the name of the method that creates the new instance.
    • If the object is created in a constructor of the class, an <init> tag is placed after the full class name.
    • The <clinit> note after the class name indicates that this is a field allocated in a static constructor or in the static block of the class.
  • Last is the line number in the source code, where the instance is created.

toString

Displays the String returned from the toString method of the corresponding object so as to differentiate objects more easily. To use this option, call the toString command from the pop-up menu on the instance.

  •    The toString command is available only if memory profiling is turned on and the target instance is a live object. In case of remote profiling, the com.prosyst.mbs.mbprofiler.api.jar must also be included in the classpath of the profiled application.
  •    In certain cases, the toString information cannot be obtained. For example, the message Object might be garbage collected might appear. Try using the command again.

Filtering Objects

There are two ways to filter the displayed objects:

Keeping Temporary Objects

To keep the temporary objects, use the option from the toolbar. As a result, the temporary objects will be virtually stored in the mBProfiler's frontend. To clear the temporary objects, check the toolbar option.

The temporary objects increase the memory usage of Eclipse, therefore make sure to enlarge its maximum memory in the eclipse.ini file.

Identifying an Object Allocation in the Call Tree

You can easily find where a specific object is created by its parent thread using different models of the call stack. Stop the memory profiling, right-click the object and select one of the following Go to commands from the popup menu:

You can also filter the call tree at Memory Call Tree so as only the threads that contain instances of a concrete class remain visible. Right-click the target class node in Objects and use the Filter in Memory Tree command.

Locating Instances in the Heap

You can find in the Heap view the object allocation in the Java heap. Right-click the object entry in Objects and use Go to > Find in Heap. If a snapshot of the heap is not available or there is new profiling data since the last one has been taken, update the heap information and locate the class's instances there by selecting Go to > Update and Find in Heap.

By executing the same commands from the pop-up menu but on a class entry you can also locate the place in the heap of all instances of the class.

Getting Information about the Activity of a Thread

To easily get runtime information about the activity of the thread holding a certain object from the Objects view, right-click the object node and select Go to > Find in Threads. mBProfiler will switch you to Threads view with the information about the target thread highlighted. The Threads view will offer details about the activity events of the thread. For more information about thread profiling data, refer to the Monitoring Thread Activity guide.

Identifying the Amount of Class Instances

You can easily view how many instances are created for a class and what amount of memory is reserved for them. Right-click the class or object node and select Go to > Find in Classes. mBProfiler will open the Classes view with the relevant class entry selected.

Excluding Objects from Results

By means of exclude method filters the Objects view supports narrowing the amount of profiling data so that only most useful information remains visible. The options to introduce and apply such filters are the same as in the Memory Call Tree view.

As a result from applying the exclude method filters, mBProfiler will remove all objects whose originator stack traces contain one of the exclude methods.