| Index: src/heap-snapshot-generator.cc
|
| diff --git a/src/heap-snapshot-generator.cc b/src/heap-snapshot-generator.cc
|
| index c4da47cb48ea674d063eb7d71f23eee6614a6c2f..0c354c70eea024ced4008bc58cb21010de14c9d4 100644
|
| --- a/src/heap-snapshot-generator.cc
|
| +++ b/src/heap-snapshot-generator.cc
|
| @@ -188,14 +188,12 @@ template <size_t ptr_size> struct SnapshotSizeConstants;
|
| template <> struct SnapshotSizeConstants<4> {
|
| static const int kExpectedHeapGraphEdgeSize = 12;
|
| static const int kExpectedHeapEntrySize = 24;
|
| - static const int kExpectedHeapSnapshotsCollectionSize = 100;
|
| static const int kExpectedHeapSnapshotSize = 132;
|
| };
|
|
|
| template <> struct SnapshotSizeConstants<8> {
|
| static const int kExpectedHeapGraphEdgeSize = 24;
|
| static const int kExpectedHeapEntrySize = 32;
|
| - static const int kExpectedHeapSnapshotsCollectionSize = 152;
|
| static const int kExpectedHeapSnapshotSize = 160;
|
| };
|
|
|
| @@ -377,7 +375,8 @@ const SnapshotObjectId HeapObjectsMap::kFirstAvailableObjectId =
|
| HeapObjectsMap::HeapObjectsMap(Heap* heap)
|
| : next_id_(kFirstAvailableObjectId),
|
| entries_map_(AddressesMatch),
|
| - heap_(heap) {
|
| + heap_(heap),
|
| + last_gc_time_(0) {
|
| // This dummy element solves a problem with entries_map_.
|
| // When we do lookup in HashMap we see no difference between two cases:
|
| // it has an entry with NULL as the value or it has created
|
| @@ -464,9 +463,17 @@ void HeapObjectsMap::StopHeapObjectsTracking() {
|
| time_intervals_.Clear();
|
| }
|
|
|
| +
|
| void HeapObjectsMap::UpdateHeapObjectsMap() {
|
| - HEAP->CollectAllGarbage(Heap::kMakeHeapIterableMask,
|
| - "HeapSnapshotsCollection::UpdateHeapObjectsMap");
|
| + double now = OS::TimeCurrentMillis();
|
| + if (now - last_gc_time_ > 1000) {
|
| + HEAP->CollectAllGarbage(Heap::kMakeHeapIterableMask,
|
| + "HeapObjectsMap::UpdateHeapObjectsMap");
|
| + last_gc_time_ = now;
|
| + } else {
|
| + HEAP->EnsureHeapIsIterable();
|
| + }
|
| +
|
| HeapIterator iterator(heap_);
|
| for (HeapObject* obj = iterator.next();
|
| obj != NULL;
|
| @@ -655,9 +662,6 @@ Handle<HeapObject> HeapSnapshotsCollection::FindHeapObjectById(
|
|
|
|
|
| size_t HeapSnapshotsCollection::GetUsedMemorySize() const {
|
| - STATIC_CHECK(SnapshotSizeConstants<kPointerSize>::
|
| - kExpectedHeapSnapshotsCollectionSize ==
|
| - sizeof(HeapSnapshotsCollection)); // NOLINT
|
| size_t size = sizeof(*this);
|
| size += names_.GetUsedMemorySize();
|
| size += ids_.GetUsedMemorySize();
|
|
|