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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@9252 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 81df4a42
...@@ -1090,6 +1090,16 @@ void SourceGroup::WaitForThread() { ...@@ -1090,6 +1090,16 @@ void SourceGroup::WaitForThread() {
#endif // V8_SHARED #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[]) { bool Shell::SetOptions(int argc, char* argv[]) {
for (int i = 0; i < argc; i++) { for (int i = 0; i < argc; i++) {
if (strcmp(argv[i], "--stress-opt") == 0) { if (strcmp(argv[i], "--stress-opt") == 0) {
...@@ -1198,7 +1208,7 @@ bool Shell::SetOptions(int argc, char* argv[]) { ...@@ -1198,7 +1208,7 @@ bool Shell::SetOptions(int argc, char* argv[]) {
v8::V8::SetFlagsFromCommandLine(&argc, argv, true); v8::V8::SetFlagsFromCommandLine(&argc, argv, true);
// set up isolated source groups // Set up isolated source groups.
options.isolate_sources = new SourceGroup[options.num_isolates]; options.isolate_sources = new SourceGroup[options.num_isolates];
SourceGroup* current = options.isolate_sources; SourceGroup* current = options.isolate_sources;
current->Begin(argv, 1); current->Begin(argv, 1);
......
...@@ -191,6 +191,8 @@ class ShellOptions { ...@@ -191,6 +191,8 @@ class ShellOptions {
num_isolates(1), num_isolates(1),
isolate_sources(NULL) { } isolate_sources(NULL) { }
~ShellOptions();
#ifndef V8_SHARED #ifndef V8_SHARED
bool use_preemption; bool use_preemption;
int preemption_interval; int preemption_interval;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment