OSDN Git Service

Moved a BufferedOutputStream onto the heap to reduce stack usage.
authorAlex Light <allight@google.com>
Thu, 29 May 2014 22:42:47 +0000 (15:42 -0700)
committerAlex Light <allight@google.com>
Fri, 30 May 2014 00:39:39 +0000 (17:39 -0700)
Bug: 15278350
Change-Id: I6aa7cf3979453e555686610e90520b762b812f8c

compiler/elf_writer_quick.cc

index e88ed42..09f2eae 100644 (file)
@@ -739,8 +739,8 @@ bool ElfWriterQuick::Write(OatWriter* oat_writer,
                 << " for " << elf_file_->GetPath();
     return false;
   }
-  BufferedOutputStream output_stream(new FileOutputStream(elf_file_));
-  if (!oat_writer->Write(&output_stream)) {
+  std::unique_ptr<BufferedOutputStream> output_stream(new BufferedOutputStream(new FileOutputStream(elf_file_)));
+  if (!oat_writer->Write(output_stream.get())) {
     PLOG(ERROR) << "Failed to write .rodata and .text for " << elf_file_->GetPath();
     return false;
   }