This is the mail archive of the mailing list for the binutils project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Dwp tool heap usage, reducing the memory foot-print.


    We do dwp runs involving very large .dwp/.dwo files (a few GB).  I
was looking at reducing the memory foot-print of dwp and we noticed
this in function void Dwp_output_file::finalize():

  // Write the debug string table.
  if (this->have_strings_)
      section_size_type len = this->stringpool_.get_strtab_size();
      buf = new unsigned char[len];
      this->stringpool_.write_to_buffer(buf, len);

We are allocating a heap buffer to copy the stringpool buffer and then
writing that to the output file.  Why not just do it directly?  I see
this is done in two places, one to write the debug string table and
another to write the section string table.  These allocations are
pretty significant (each ~20% the size of the input files combined).

Looking into stringpool functions, I see there is one to write
directly to a file
template<typename Stringpool_char>
void Stringpool_template<Stringpool_char>::write(Output_file* of, off_t offset)

but that needs an Output_file object and we dont have one. What is the
downside of eliminating this buffer?



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]