http://bugs.winehq.org/show_bug.cgi?id=33365
Bug #: 33365 Summary: Poor performance of memory allocator Product: Wine Version: unspecified Platform: x86 OS/Version: Linux Status: UNCONFIRMED Severity: major Priority: P2 Component: ntdll AssignedTo: wine-bugs@winehq.org ReportedBy: alexpigna.dev@gmail.com Classification: Unclassified
If there are many blocks of the same size in one of the free lists and a slightly larger block which falls into the same free list is allocated the list will be linearly scanned for a suitable block, potentially blocking for a very long time. This situation actually happens in the game Deponia, under certain conditions.
A possible solution would be to round up all allocated blocks in a size category to the maximum size of the category. In this way the allocator could always get the first block from a free list. This would waste some bytes, for each allocation, but avoid the linear search. This solution would be similar to how the jemalloc allocator works AFAIK.