diff options
author | Siva Velusamy <vsiva@google.com> | 2011-11-06 10:17:15 -0800 |
---|---|---|
committer | Siva Velusamy <vsiva@google.com> | 2011-11-06 10:17:15 -0800 |
commit | b2645269bfab7c04243dc2a4bea03b33463bc6d1 (patch) | |
tree | 79da906788629227cf473121f4bdcd419d185c0c /ddms/libs | |
parent | 4820ea88f12c1635489371f587e9b6ab70f16672 (diff) | |
download | sdk-b2645269bfab7c04243dc2a4bea03b33463bc6d1.zip sdk-b2645269bfab7c04243dc2a4bea03b33463bc6d1.tar.gz sdk-b2645269bfab7c04243dc2a4bea03b33463bc6d1.tar.bz2 |
nativeheap: Do not clean up display if a client is killed.
Fix for Issue #21554. When a client process dies, the native
heap view is immediately cleared. This makes it impossible to
view the native heap snapshots for processes that are being
killed due to OOM errors.
Change-Id: I3b6c868832c6b48e591d31d1643db20887ff8c13
Diffstat (limited to 'ddms/libs')
-rw-r--r-- | ddms/libs/ddmuilib/src/com/android/ddmuilib/heap/NativeHeapPanel.java | 38 |
1 files changed, 21 insertions, 17 deletions
diff --git a/ddms/libs/ddmuilib/src/com/android/ddmuilib/heap/NativeHeapPanel.java b/ddms/libs/ddmuilib/src/com/android/ddmuilib/heap/NativeHeapPanel.java index e085f2c..72cdc22 100644 --- a/ddms/libs/ddmuilib/src/com/android/ddmuilib/heap/NativeHeapPanel.java +++ b/ddms/libs/ddmuilib/src/com/android/ddmuilib/heap/NativeHeapPanel.java @@ -326,30 +326,34 @@ public class NativeHeapPanel extends BaseHeapPanel { public void clientSelected() { Client c = getCurrentClient(); + if (c == null) { + // if there is no client selected, then we disable the buttons but leave the + // display as is so that whatever snapshots are displayed continue to stay + // visible to the user. + mSnapshotHeapButton.setEnabled(false); + mLoadHeapDataButton.setEnabled(false); + return; + } + mNativeHeapSnapshots = new ArrayList<NativeHeapSnapshot>(); mDiffSnapshots = new ArrayList<NativeHeapSnapshot>(); - if (c != null) { - mSnapshotHeapButton.setEnabled(true); - mLoadHeapDataButton.setEnabled(true); + mSnapshotHeapButton.setEnabled(true); + mLoadHeapDataButton.setEnabled(true); - List<NativeHeapSnapshot> importedSnapshots = mImportedSnapshotsPerPid.get( - c.getClientData().getPid()); - if (importedSnapshots != null) { - for (NativeHeapSnapshot n : importedSnapshots) { - addNativeHeapSnapshot(n); - } + List<NativeHeapSnapshot> importedSnapshots = mImportedSnapshotsPerPid.get( + c.getClientData().getPid()); + if (importedSnapshots != null) { + for (NativeHeapSnapshot n : importedSnapshots) { + addNativeHeapSnapshot(n); } + } - List<NativeAllocationInfo> allocations = c.getClientData().getNativeAllocationList(); - allocations = shallowCloneList(allocations); + List<NativeAllocationInfo> allocations = c.getClientData().getNativeAllocationList(); + allocations = shallowCloneList(allocations); - if (allocations.size() > 0) { - addNativeHeapSnapshot(new NativeHeapSnapshot(allocations)); - } - } else { - mSnapshotHeapButton.setEnabled(false); - mLoadHeapDataButton.setEnabled(false); + if (allocations.size() > 0) { + addNativeHeapSnapshot(new NativeHeapSnapshot(allocations)); } updateDisplay(); |