mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-06-11 18:20:43 +09:00
LibELF: Unmap and close the main executable after dynamic load
We don't need to keep the whole main executable in memory after completing the dynamic loading process. We can also close the fd.
This commit is contained in:
parent
5b891b0c36
commit
40a5487bab
Notes:
sideshowbarker
2024-07-18 22:22:08 +09:00
Author: https://github.com/awesomekling
Commit: 40a5487bab
2 changed files with 14 additions and 3 deletions
|
@ -87,8 +87,14 @@ DynamicLoader::DynamicLoader(int fd, String filename, void* data, size_t size)
|
|||
|
||||
DynamicLoader::~DynamicLoader()
|
||||
{
|
||||
munmap(m_file_data, m_file_size);
|
||||
close(m_image_fd);
|
||||
if (munmap(m_file_data, m_file_size) < 0) {
|
||||
perror("munmap");
|
||||
ASSERT_NOT_REACHED();
|
||||
}
|
||||
if (close(m_image_fd) < 0) {
|
||||
perror("close");
|
||||
ASSERT_NOT_REACHED();
|
||||
}
|
||||
}
|
||||
|
||||
const DynamicObject& DynamicLoader::dynamic_object() const
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue