This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Dwp tool heap usage, reducing the memory foot-print.
- From: Sriraman Tallam <tmsriram at google dot com>
- To: binutils <binutils at sourceware dot org>, Cary Coutant <ccoutant at gmail dot com>, Sterling Augustine <saugustine at google dot com>, Than McIntosh <thanm at google dot com>, David Li <davidxl at google dot com>
- Date: Tue, 17 Nov 2015 14:56:42 -0800
- Subject: Dwp tool heap usage, reducing the memory foot-print.
- Authentication-results: sourceware.org; auth=none
Hi,
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_)
{
this->stringpool_.set_string_offsets();
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?
Thoughts?
Thanks
Sri