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

Side by Side Diff: runtime/vm/thread.cc

Issue 1677043003: 1. Fix memory leaks reported by running a simple test using ASAN (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 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
« runtime/vm/cpuinfo_macos.cc ('K') | « runtime/vm/cpuinfo_win.cc ('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 (c) 2015, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #include "vm/thread.h" 5 #include "vm/thread.h"
6 6
7 #include "vm/dart_api_state.h" 7 #include "vm/dart_api_state.h"
8 #include "vm/growable_array.h" 8 #include "vm/growable_array.h"
9 #include "vm/isolate.h" 9 #include "vm/isolate.h"
10 #include "vm/lockers.h" 10 #include "vm/lockers.h"
11 #include "vm/log.h" 11 #include "vm/log.h"
12 #include "vm/native_entry.h" 12 #include "vm/native_entry.h"
13 #include "vm/object.h" 13 #include "vm/object.h"
14 #include "vm/os_thread.h" 14 #include "vm/os_thread.h"
15 #include "vm/profiler.h" 15 #include "vm/profiler.h"
16 #include "vm/runtime_entry.h" 16 #include "vm/runtime_entry.h"
17 #include "vm/stub_code.h" 17 #include "vm/stub_code.h"
18 #include "vm/symbols.h" 18 #include "vm/symbols.h"
19 #include "vm/thread_interrupter.h" 19 #include "vm/thread_interrupter.h"
20 #include "vm/thread_registry.h" 20 #include "vm/thread_registry.h"
21 21
22 namespace dart { 22 namespace dart {
23 23
24 Thread::~Thread() { 24 Thread::~Thread() {
25 // We should cleanly exit any isolate before destruction. 25 // We should cleanly exit any isolate before destruction.
26 ASSERT(isolate_ == NULL); 26 ASSERT(isolate_ == NULL);
27 // There should be no top api scopes at this point.
28 ASSERT(api_top_scope() == NULL);
29 // Delete the resusable api scope if there is one.
30 if (api_reusable_scope_) {
31 delete api_reusable_scope_;
32 api_reusable_scope_ = NULL;
33 }
34 delete thread_lock_;
35 thread_lock_ = NULL;
27 } 36 }
28 37
29 38
30 #if defined(DEBUG) 39 #if defined(DEBUG)
31 #define REUSABLE_HANDLE_SCOPE_INIT(object) \ 40 #define REUSABLE_HANDLE_SCOPE_INIT(object) \
32 reusable_##object##_handle_scope_active_(false), 41 reusable_##object##_handle_scope_active_(false),
33 #else 42 #else
34 #define REUSABLE_HANDLE_SCOPE_INIT(object) 43 #define REUSABLE_HANDLE_SCOPE_INIT(object)
35 #endif // defined(DEBUG) 44 #endif // defined(DEBUG)
36 45
(...skipping 458 matching lines...) Expand 10 before | Expand all | Expand 10 after
495 504
496 DisableThreadInterruptsScope::~DisableThreadInterruptsScope() { 505 DisableThreadInterruptsScope::~DisableThreadInterruptsScope() {
497 if (thread() != NULL) { 506 if (thread() != NULL) {
498 OSThread* os_thread = thread()->os_thread(); 507 OSThread* os_thread = thread()->os_thread();
499 ASSERT(os_thread != NULL); 508 ASSERT(os_thread != NULL);
500 os_thread->EnableThreadInterrupts(); 509 os_thread->EnableThreadInterrupts();
501 } 510 }
502 } 511 }
503 512
504 } // namespace dart 513 } // namespace dart
OLDNEW
« runtime/vm/cpuinfo_macos.cc ('K') | « runtime/vm/cpuinfo_win.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698