If you cannot suspend your application, for example if the application is running in a production environment, AppMon provides the means for trending snapshots and selective memory snapshots. Trending snapshots do not contain every instance or references between instances. However, they provide an overview of which instances are growing. You can use this information in conjunction with selective memory snapshots to find where in an application the instances of a growing class are allocated.
You can use trending memory snapshots to determine which classes are top-most instantiated and compare them in the Memory Comparison dashlet among multiple snapshots created over time. Here you can define Memory Sensor Rules for growing classes, and use them to create selective memory snapshots.
Selective memory snapshots track the instantiation of selected classes defined by Memory Sensor rules. They identify the point in the code where instances are allocated. They do not stall the VM or CLR while they are created. However, they introduce some overhead for heap memory and CPU usage, especially when many instances are generated. See Selective Memory dashlet for details regarding selective memory snapshots.
General steps are:
Create trending memory snapshots. You can use one of the following ways:
- In the Total Memory dashlet, using the Memory Consumption Trending option.
- Using incidents.
- Using automated Memory Snapshot tasks that periodically trigger a snapshot.
AppMon persists all memory dumps onto the hard disk of the AppMon Server. This can fill up the disk, especially when creating scheduled dumps of larger VMs or CLRs. Unless suppressed by clearing the options in the Create Memory Snapshot dialog box, garbage collection is forced before a memory dump to prevent including already unreferenced objects and to provide better accuracy. Trending snapshots are, however, quite small. One snapshot requires approximately 1‐2 MB per on disk.
In the Total Memory dashlet, select the snapshots, right-click, and select Compare.
In the Memory Comparison dashlet, you can find the classes where the number of instances or their sizes are growing.
Create and deploy Memory Sensor Rules for these classes:
- Right-click the required classes and select Create Memory Sensor Rule > Include in Memory Sensor Rule.
- The new sensor group is created, and shown in Sensors item of the System Profile Preferences dialog box.
- Give the group a meaningful name. Click Edit group icon, and specify the name.
- Make sure that the Place property is set to include.
- Click OK to save the newly created group.
- Open the System Profile Preferences dialog box, and select the Sensor item.
- Expand the Agent group, monitoring the app under investigation, and select the Sensor placement item.
- Place the newly created sensor pack. If Hot Sensor Placement is not available, restart your application.
In the Selective Memory dashlet create memory snapshot with the required Agent.