Add segment free_data function

Allow for segment data to be freed to allow for reduced memory usage
when dealing with large elf segments.
This commit is contained in:
Eugene Cohen 2023-09-22 09:49:39 -07:00 committed by Serge Lamikhov-Center
parent 73a241079a
commit 23527bd291

View File

@ -48,6 +48,7 @@ class segment
ELFIO_GET_ACCESS_DECL( Elf64_Off, offset );
virtual const char* get_data() const = 0;
virtual void free_data() const = 0;
virtual Elf_Half add_section( section* psec, Elf_Xword addr_align ) = 0;
virtual Elf_Half add_section_index( Elf_Half index,
@ -104,6 +105,12 @@ template <class T> class segment_impl : public segment
return data.get();
}
void free_data() const override
{
data.reset(nullptr);
is_lazy = true;
}
//------------------------------------------------------------------------------
Elf_Half add_section_index( Elf_Half sec_index,
Elf_Xword addr_align ) override