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

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

Issue 2620413002: Fix various memory leaks in unit tests detected by a new version of ASAN. (Closed)
Patch Set: . Created 3 years, 11 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
« no previous file with comments | « no previous file | runtime/vm/compiler_test.cc » ('j') | 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) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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/benchmark_test.h" 5 #include "vm/benchmark_test.h"
6 6
7 #include "bin/builtin.h" 7 #include "bin/builtin.h"
8 #include "bin/file.h" 8 #include "bin/file.h"
9 #include "bin/isolate_data.h" 9 #include "bin/isolate_data.h"
10 10
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 SetExecutable(executable); 89 SetExecutable(executable);
90 Benchmark* benchmark = first_; 90 Benchmark* benchmark = first_;
91 while (benchmark != NULL) { 91 while (benchmark != NULL) {
92 benchmark->RunBenchmark(); 92 benchmark->RunBenchmark();
93 benchmark = benchmark->next_; 93 benchmark = benchmark->next_;
94 } 94 }
95 } 95 }
96 96
97 97
98 Dart_Isolate Benchmark::CreateIsolate(const uint8_t* buffer) { 98 Dart_Isolate Benchmark::CreateIsolate(const uint8_t* buffer) {
99 bin::IsolateData* isolate_data = new bin::IsolateData(NULL, NULL, NULL);
100 char* err = NULL; 99 char* err = NULL;
101 isolate_ = Dart_CreateIsolate(NULL, NULL, buffer, NULL, isolate_data, &err); 100 isolate_ = Dart_CreateIsolate(NULL, NULL, buffer, NULL, NULL, &err);
102 EXPECT(isolate_ != NULL); 101 EXPECT(isolate_ != NULL);
103 free(err); 102 free(err);
104 return isolate_; 103 return isolate_;
105 } 104 }
106 105
107 106
108 // 107 //
109 // Measure compile of all functions in dart core lib classes. 108 // Measure compile of all functions in dart core lib classes.
110 // 109 //
111 BENCHMARK(CorelibCompileAll) { 110 BENCHMARK(CorelibCompileAll) {
(...skipping 401 matching lines...) Expand 10 before | Expand all | Expand 10 after
513 Api::CheckAndFinalizePendingClasses(thread); 512 Api::CheckAndFinalizePendingClasses(thread);
514 513
515 // Write snapshot with object content. 514 // Write snapshot with object content.
516 FullSnapshotWriter writer(Snapshot::kCore, &vm_isolate_snapshot_buffer, 515 FullSnapshotWriter writer(Snapshot::kCore, &vm_isolate_snapshot_buffer,
517 &isolate_snapshot_buffer, &malloc_allocator, 516 &isolate_snapshot_buffer, &malloc_allocator,
518 NULL /* instructions_writer */); 517 NULL /* instructions_writer */);
519 writer.WriteFullSnapshot(); 518 writer.WriteFullSnapshot();
520 const Snapshot* snapshot = Snapshot::SetupFromBuffer(isolate_snapshot_buffer); 519 const Snapshot* snapshot = Snapshot::SetupFromBuffer(isolate_snapshot_buffer);
521 ASSERT(snapshot->kind() == Snapshot::kCore); 520 ASSERT(snapshot->kind() == Snapshot::kCore);
522 benchmark->set_score(snapshot->length()); 521 benchmark->set_score(snapshot->length());
522
523 free(vm_isolate_snapshot_buffer);
524 free(isolate_snapshot_buffer);
523 } 525 }
524 526
525 527
526 BENCHMARK_SIZE(StandaloneSnapshotSize) { 528 BENCHMARK_SIZE(StandaloneSnapshotSize) {
527 const char* kScriptChars = 529 const char* kScriptChars =
528 "import 'dart:async';\n" 530 "import 'dart:async';\n"
529 "import 'dart:core';\n" 531 "import 'dart:core';\n"
530 "import 'dart:collection';\n" 532 "import 'dart:collection';\n"
531 "import 'dart:_internal';\n" 533 "import 'dart:_internal';\n"
532 "import 'dart:convert';\n" 534 "import 'dart:convert';\n"
(...skipping 14 matching lines...) Expand all
547 Api::CheckAndFinalizePendingClasses(thread); 549 Api::CheckAndFinalizePendingClasses(thread);
548 550
549 // Write snapshot with object content. 551 // Write snapshot with object content.
550 FullSnapshotWriter writer(Snapshot::kCore, &vm_isolate_snapshot_buffer, 552 FullSnapshotWriter writer(Snapshot::kCore, &vm_isolate_snapshot_buffer,
551 &isolate_snapshot_buffer, &malloc_allocator, 553 &isolate_snapshot_buffer, &malloc_allocator,
552 NULL /* instructions_writer */); 554 NULL /* instructions_writer */);
553 writer.WriteFullSnapshot(); 555 writer.WriteFullSnapshot();
554 const Snapshot* snapshot = Snapshot::SetupFromBuffer(isolate_snapshot_buffer); 556 const Snapshot* snapshot = Snapshot::SetupFromBuffer(isolate_snapshot_buffer);
555 ASSERT(snapshot->kind() == Snapshot::kCore); 557 ASSERT(snapshot->kind() == Snapshot::kCore);
556 benchmark->set_score(snapshot->length()); 558 benchmark->set_score(snapshot->length());
559
560 free(vm_isolate_snapshot_buffer);
561 free(isolate_snapshot_buffer);
557 } 562 }
558 563
559 564
560 BENCHMARK(CreateMirrorSystem) { 565 BENCHMARK(CreateMirrorSystem) {
561 const char* kScriptChars = 566 const char* kScriptChars =
562 "import 'dart:mirrors';\n" 567 "import 'dart:mirrors';\n"
563 "\n" 568 "\n"
564 "void benchmark() {\n" 569 "void benchmark() {\n"
565 " currentMirrorSystem();\n" 570 " currentMirrorSystem();\n"
566 "}\n"; 571 "}\n";
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
706 int64_t elapsed_time = timer.TotalElapsedTime(); 711 int64_t elapsed_time = timer.TotalElapsedTime();
707 benchmark->set_score(elapsed_time); 712 benchmark->set_score(elapsed_time);
708 } 713 }
709 714
710 715
711 BENCHMARK_MEMORY(InitialRSS) { 716 BENCHMARK_MEMORY(InitialRSS) {
712 benchmark->set_score(OS::MaxRSS()); 717 benchmark->set_score(OS::MaxRSS());
713 } 718 }
714 719
715 } // namespace dart 720 } // namespace dart
OLDNEW
« no previous file with comments | « no previous file | runtime/vm/compiler_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698