Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(290)

Side by Side Diff: src/profile-generator.cc

Issue 9375047: Heap Snapshot maximum size limit is too low for really big apps. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: the limit depends from the platform. Created 8 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/profile-generator.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 3393 matching lines...) Expand 10 before | Expand all | Expand 10 after
3404 v8::OutputStream::kAbort) aborted_ = true; 3404 v8::OutputStream::kAbort) aborted_ = true;
3405 } 3405 }
3406 3406
3407 v8::OutputStream* stream_; 3407 v8::OutputStream* stream_;
3408 int chunk_size_; 3408 int chunk_size_;
3409 ScopedVector<char> chunk_; 3409 ScopedVector<char> chunk_;
3410 int chunk_pos_; 3410 int chunk_pos_;
3411 bool aborted_; 3411 bool aborted_;
3412 }; 3412 };
3413 3413
3414 #if defined(V8_TARGET_ARCH_X64)
3415 const int HeapSnapshotJSONSerializer::kMaxSerializableSnapshotRawSize =
3416 768 * MB;
mnaganov (inactive) 2012/02/10 12:33:50 I know a better place for this: SnapshotSizeConsta
3417 #else
3414 const int HeapSnapshotJSONSerializer::kMaxSerializableSnapshotRawSize = 3418 const int HeapSnapshotJSONSerializer::kMaxSerializableSnapshotRawSize =
3415 256 * MB; 3419 256 * MB;
3420 #endif
3416 3421
3417 void HeapSnapshotJSONSerializer::Serialize(v8::OutputStream* stream) { 3422 void HeapSnapshotJSONSerializer::Serialize(v8::OutputStream* stream) {
3418 ASSERT(writer_ == NULL); 3423 ASSERT(writer_ == NULL);
3419 writer_ = new OutputStreamWriter(stream); 3424 writer_ = new OutputStreamWriter(stream);
3420 3425
3421 HeapSnapshot* original_snapshot = NULL; 3426 HeapSnapshot* original_snapshot = NULL;
3422 if (snapshot_->raw_entries_size() >= kMaxSerializableSnapshotRawSize) { 3427 if (snapshot_->raw_entries_size() >= kMaxSerializableSnapshotRawSize) {
3423 // The snapshot is too big. Serialize a fake snapshot. 3428 // The snapshot is too big. Serialize a fake snapshot.
3424 original_snapshot = snapshot_; 3429 original_snapshot = snapshot_;
3425 snapshot_ = CreateFakeSnapshot(); 3430 snapshot_ = CreateFakeSnapshot(snapshot_->raw_entries_size());
mnaganov (inactive) 2012/02/10 12:33:50 Why can't CreateFakeSnapshot extract this value it
3426 } 3431 }
3427 // Since nodes graph is cyclic, we need the first pass to enumerate 3432 // Since nodes graph is cyclic, we need the first pass to enumerate
3428 // them. Strings can be serialized in one pass. 3433 // them. Strings can be serialized in one pass.
3429 EnumerateNodes(); 3434 EnumerateNodes();
3430 SerializeImpl(); 3435 SerializeImpl();
3431 3436
3432 delete writer_; 3437 delete writer_;
3433 writer_ = NULL; 3438 writer_ = NULL;
3434 3439
3435 if (original_snapshot != NULL) { 3440 if (original_snapshot != NULL) {
3436 delete snapshot_; 3441 delete snapshot_;
3437 snapshot_ = original_snapshot; 3442 snapshot_ = original_snapshot;
3438 } 3443 }
3439 } 3444 }
3440 3445
3441 3446
3442 HeapSnapshot* HeapSnapshotJSONSerializer::CreateFakeSnapshot() { 3447 HeapSnapshot* HeapSnapshotJSONSerializer::CreateFakeSnapshot(
3448 int raw_snapshot_size) {
3443 HeapSnapshot* result = new HeapSnapshot(snapshot_->collection(), 3449 HeapSnapshot* result = new HeapSnapshot(snapshot_->collection(),
3444 HeapSnapshot::kFull, 3450 HeapSnapshot::kFull,
3445 snapshot_->title(), 3451 snapshot_->title(),
3446 snapshot_->uid()); 3452 snapshot_->uid());
3447 result->AllocateEntries(2, 1, 0); 3453 result->AllocateEntries(2, 1, 0);
3448 HeapEntry* root = result->AddRootEntry(1); 3454 HeapEntry* root = result->AddRootEntry(1);
3455 const char* text = snapshot_->collection()->names()->GetFormatted(
3456 "The snapshot is too big. "
3457 "Maximum snapshot size is %d MB. "
3458 "Actual snapshot size is %d MB.",
3459 kMaxSerializableSnapshotRawSize / MB,
3460 (raw_snapshot_size + MB - 1) / MB);
3449 HeapEntry* message = result->AddEntry( 3461 HeapEntry* message = result->AddEntry(
3450 HeapEntry::kString, "The snapshot is too big", 0, 4, 0, 0); 3462 HeapEntry::kString, text, 0, 4, 0, 0);
3451 root->SetUnidirElementReference(0, 1, message); 3463 root->SetUnidirElementReference(0, 1, message);
3452 result->SetDominatorsToSelf(); 3464 result->SetDominatorsToSelf();
3453 return result; 3465 return result;
3454 } 3466 }
3455 3467
3456 3468
3457 void HeapSnapshotJSONSerializer::SerializeImpl() { 3469 void HeapSnapshotJSONSerializer::SerializeImpl() {
3458 writer_->AddCharacter('{'); 3470 writer_->AddCharacter('{');
3459 writer_->AddString("\"snapshot\":{"); 3471 writer_->AddString("\"snapshot\":{");
3460 SerializeSnapshot(); 3472 SerializeSnapshot();
(...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after
3727 3739
3728 3740
3729 void HeapSnapshotJSONSerializer::SortHashMap( 3741 void HeapSnapshotJSONSerializer::SortHashMap(
3730 HashMap* map, List<HashMap::Entry*>* sorted_entries) { 3742 HashMap* map, List<HashMap::Entry*>* sorted_entries) {
3731 for (HashMap::Entry* p = map->Start(); p != NULL; p = map->Next(p)) 3743 for (HashMap::Entry* p = map->Start(); p != NULL; p = map->Next(p))
3732 sorted_entries->Add(p); 3744 sorted_entries->Add(p);
3733 sorted_entries->Sort(SortUsingEntryValue); 3745 sorted_entries->Sort(SortUsingEntryValue);
3734 } 3746 }
3735 3747
3736 } } // namespace v8::internal 3748 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/profile-generator.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698