Bug 300882
| Summary: | [GTK][WPE] Fix tracking and leaking reallocated memory with MALLOC_HEAP_BREAKDOWN | ||
|---|---|---|---|
| Product: | WebKit | Reporter: | Olivier Blin <olivier.blin> |
| Component: | WPE WebKit | Assignee: | Nobody <webkit-unassigned> |
| Status: | RESOLVED FIXED | ||
| Severity: | Normal | CC: | bugs-noreply, jmichaud, loic.yhuel, plampe |
| Priority: | P2 | ||
| Version: | WebKit Nightly Build | ||
| Hardware: | Unspecified | ||
| OS: | Unspecified | ||
Olivier Blin
With MALLOC_HEAP_BREAKDOWN on GLib ports, memory reallocated with zoneRealloc() is not tracked properly.
If realloc() returns a different pointer, the old pointer is left accounted for in the zone allocations with the new size, and the new pointer is not tracked at all.
So when the new pointer is freed by zoneFree(), the old pointer allocation remains in the allocation statistics.
This has been noticed with a backport of this feature on WPE 2.42, which showed incorrect leaks of AssemblerData and MetadataTable objects.
| Attachments | ||
|---|---|---|
| Add attachment proposed patch, testcase, etc. |
Olivier Blin
Pull request: https://github.com/WebKit/WebKit/pull/52467
Olivier Blin
As noticed by Loïc, this was also leaking the reallocated memory, because zoneFree() checks if the freed pointer exists in the tracked allocation.
Since it was not tracked properly, the actual free() was not called.
EWS
Committed 301709@main (ea2e6d0dea2c): <https://commits.webkit.org/301709@main>
Reviewed commits have been landed. Closing PR #52467 and removing active labels.