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

Unified Diff: runtime/vm/isolate.cc

Issue 11478012: Provide a mechanism for dumping of heap profiles on predefined events. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: address review comments Created 8 years 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/vm/heap.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/isolate.cc
diff --git a/runtime/vm/isolate.cc b/runtime/vm/isolate.cc
index 6ea666142ba5ae7913cf576edf757c12cef34c9f..c7d06328e287fa021ef61ba4ab75e0d5a7f4619b 100644
--- a/runtime/vm/isolate.cc
+++ b/runtime/vm/isolate.cc
@@ -30,6 +30,7 @@ DEFINE_FLAG(bool, report_usage_count, false,
"Track function usage and report.");
DEFINE_FLAG(bool, trace_isolates, false,
"Trace isolate creation and shut down.");
+DECLARE_FLAG(bool, heap_profile_out_of_memory);
DECLARE_FLAG(bool, generate_gdb_symbols);
@@ -139,6 +140,18 @@ bool IsolateMessageHandler::IsCurrentIsolate() const {
bool IsolateMessageHandler::ProcessUnhandledException(const Object& result) {
isolate_->object_store()->set_sticky_error(Error::Cast(result));
+ if (FLAG_heap_profile_out_of_memory) {
+ Instance& exception = Instance::Handle();
+ if (result.IsUnhandledException()) {
+ exception ^= UnhandledException::Cast(result).exception();
+ } else {
+ ASSERT(result.IsError());
+ exception ^= result.raw();
siva 2012/12/10 05:06:36 I think this else part is not needed and the OOM c
+ }
+ if (exception.raw() == isolate_->object_store()->out_of_memory()) {
+ isolate_->heap()->ProfileToFile("out-of-memory");
+ }
+ }
// Invoke the dart unhandled exception callback if there is one.
if (Isolate::UnhandledExceptionCallback() != NULL) {
Dart_EnterScope();
« no previous file with comments | « runtime/vm/heap.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698