mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 19:47:46 +00:00
UserspaceEmulator: Implement very basic leak checking :^)
Upon exit, the emulator will now print a leak report of any malloc allocations that are still live and don't have pointers to their base address anywhere in either another live mallocation, or in one of the non-malloc-block memory regions. Note that the malloc-block memory region check is not fully functional and this will work even better once we get that fixed. This is pretty cool. :^)
This commit is contained in:
parent
7e13244238
commit
f6584bfc36
4 changed files with 78 additions and 2 deletions
|
@ -44,6 +44,8 @@ public:
|
|||
void audit_read(FlatPtr address, size_t);
|
||||
void audit_write(FlatPtr address, size_t);
|
||||
|
||||
void dump_leak_report();
|
||||
|
||||
private:
|
||||
struct Mallocation {
|
||||
bool contains(FlatPtr a) const
|
||||
|
@ -57,8 +59,11 @@ private:
|
|||
};
|
||||
|
||||
Mallocation* find_mallocation(FlatPtr);
|
||||
bool is_reachable(const Mallocation&) const;
|
||||
|
||||
Vector<Mallocation> m_mallocations;
|
||||
|
||||
bool m_auditing_enabled { true };
|
||||
};
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue