With current mesa git it is not possible to play various 32bit games with wine, as the d3d hlsl to glsl translator generates many non-trivial shaders.
For unity games like "Ori and the blind forest", they just crash after the whole 4 GiB address space is exhausted and malloc cannot return any more space.
The vast majority of the allocation calls are caused by ralloc_size called from brw_* and other shader related functions.
As a workaround I built i965_dri.so from https://cgit.freedesktop.org/~jljusten/mesa/commit/?h=i965-shader-cache and I was able to run the game by letting it compile the shaders until it runs out of memory, repeated until the shader cache is sufficiently filled so that subsequent starts do not run out of memory anymore. Now the game uses barely more than 1GiB after startup. The ~/.cache/mesa directory contains 26MiB, which indicates (AFAICT) that some stage in the shader compilation process does not free its resources correctly.
So it's likely a memory leak somewhere, but I don't know how to debug that to provide more information.
Are you able to reproduce this with apitrace? (Presumably, you'd need to replay with a 32-bit version of glretrace...)
(In reply to Kenneth Graunke from comment #1)
> Are you able to reproduce this with apitrace? (Presumably, you'd need to
> replay with a 32-bit version of glretrace...)
I can - with a 64 bit version as well, it just gets killed by the kernel on OOM instead of running out of memory (malloc returning NULL).
Created attachment 134844 [details]
Screenshot of leaking path in heaptrack
I ran glretrace with heaptrack to get a backtrace of the leaked malloc calls - I can upload the heaptrack output file if needed.
I'm not sure whether I can upload the apitrace output file due to copyright reasons.
Could you, please, try with commit d219521379626ebf2bff63e4a9c2f92725b3926a or with master.
Some improvements were done.
(In reply to Sergii Romantsov from comment #4)
> Hello, Fabian.
> Could you, please, try with commit d219521379626ebf2bff63e4a9c2f92725b3926a
> or with master.
> Some improvements were done.
Seems to work here - it doesn't exceed 3GiB anymore.
However, loading the game takes really long now, but I can't really compare it as until now it wasn't possible to load it at all without shader caching.