Revision: 9252 Author: [email protected] Date: Tue Sep 13 02:31:41 2011 Log: Fix some valgrind errors in d8 shell.
This fixes 3 possibly lost warnings occurring when running unit tests under d8:
28 bytes in 1 blocks are possibly lost in loss record 40 of 68 at 0x67FB8DB: operator new[](unsigned int) by 0x83865CC: v8::Shell::SetOptions(int, char**) (d8.cc:1200) by 0x83869A5: v8::Shell::Main(int, char**) (d8.cc:1276) by 0x8386B31: main (d8.cc:1333) Review URL: http://codereview.chromium.org/7780032 http://code.google.com/p/v8/source/detail?r=9252 Modified: /branches/bleeding_edge/src/d8.cc /branches/bleeding_edge/src/d8.h ======================================= --- /branches/bleeding_edge/src/d8.cc Mon Sep 12 06:36:43 2011 +++ /branches/bleeding_edge/src/d8.cc Tue Sep 13 02:31:41 2011 @@ -1090,6 +1090,16 @@ #endif // V8_SHARED +ShellOptions::~ShellOptions() { + delete[] isolate_sources; + isolate_sources = NULL; +#ifndef V8_SHARED + delete parallel_files; + parallel_files = NULL; +#endif // V8_SHARED +} + + bool Shell::SetOptions(int argc, char* argv[]) { for (int i = 0; i < argc; i++) { if (strcmp(argv[i], "--stress-opt") == 0) { @@ -1198,7 +1208,7 @@ v8::V8::SetFlagsFromCommandLine(&argc, argv, true); - // set up isolated source groups + // Set up isolated source groups. options.isolate_sources = new SourceGroup[options.num_isolates]; SourceGroup* current = options.isolate_sources; current->Begin(argv, 1); ======================================= --- /branches/bleeding_edge/src/d8.h Fri Sep 9 15:39:47 2011 +++ /branches/bleeding_edge/src/d8.h Tue Sep 13 02:31:41 2011 @@ -190,6 +190,8 @@ test_shell(false), num_isolates(1), isolate_sources(NULL) { } + + ~ShellOptions(); #ifndef V8_SHARED bool use_preemption; -- v8-dev mailing list [email protected] http://groups.google.com/group/v8-dev
