mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 06:47:34 +00:00
LibC+UE: Keep more unused chunked blocks around
Previously each malloc size class would keep around a limited number of unused blocks which were marked with MADV_SET_VOLATILE which could then be reinitialized when additional blocks were needed. This changes malloc() so that it also keeps around a number of blocks without marking them with MADV_SET_VOLATILE. I termed these "hot" blocks whereas blocks which were marked as MADV_SET_VOLATILE are called "cold" blocks because they're more expensive to reinitialize. In the worst case this could increase memory usage per process by 1MB when a program requests a bunch of memory and frees all of it. Also, in order to make more efficient use of these unused blocks they're now shared between size classes.
This commit is contained in:
parent
bd2b17a70e
commit
39f0739381
4 changed files with 93 additions and 35 deletions
|
@ -61,6 +61,7 @@ public:
|
|||
void target_did_malloc(Badge<Emulator>, FlatPtr address, size_t);
|
||||
void target_did_free(Badge<Emulator>, FlatPtr address);
|
||||
void target_did_realloc(Badge<Emulator>, FlatPtr address, size_t);
|
||||
void target_did_change_chunk_size(Badge<Emulator>, FlatPtr, size_t);
|
||||
|
||||
void audit_read(const Region&, FlatPtr address, size_t);
|
||||
void audit_write(const Region&, FlatPtr address, size_t);
|
||||
|
@ -79,6 +80,8 @@ private:
|
|||
void dump_memory_graph();
|
||||
void populate_memory_graph();
|
||||
|
||||
void update_metadata(MmapRegion& mmap_region, size_t chunk_size);
|
||||
|
||||
Emulator& m_emulator;
|
||||
|
||||
MemoryGraph m_memory_graph {};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue