Chromium Code Reviews| 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(); |