What they did
The poster owned the PC port of Sorcery Saga, a 2013 PS Vita game, which ran out of memory and crashed with a Malloc error after climbing a few dungeon floors. They opened the game folder in Google Antigravity with Gemini 4 and asked it to find and fix the problem. Gemini worked out that the port is a 32-bit build capped at 2 GB and wrapped in SteamStub, so editing the executable would fail its integrity check. Instead it wrote a 32-bit XINPUT1_3.dll proxy in Nim, the poster's language, using some of the poster's own libraries. The DLL loads alongside the game, reads its DirectX 11 renderer in memory and hooks the faulty calls. The poster played several sessions while the DLL collected telemetry, and Gemini refined it from the logs.
How it went
Gemini found the draw loop created depth stencil and rasterizer state objects about 3,800 times a second each without releasing them, plus a sampler wrapper that never cleared its dirty flag, leaking about 7,000 COM objects a second. The finished 193 KB DLL caches those states, which cut millions of calls down to 10 cached objects, and reserves a separate memory area for large transient assets. Memory drain went from about 4 MB a second to zero. The poster reports two hours of play at 4K with no crash, against a crash after a few floors before. It took a few hours of work.
Worth knowing
The fix avoids touching the DRM-protected executable by loading as a proxy DLL, which is why it works without breaking the game. The poster has not published it yet and commenters asked for the source, so a stranger's DLL would need checking before use. The poster plans the same approach for other ports by the same studio.