http://bugs.winehq.org/show_bug.cgi?id=34658
Bug #: 34658 Summary: Bioshock 2 runs out of GL memory quickly Product: Wine Version: 1.7.3 Platform: x86 OS/Version: Linux Status: UNCONFIRMED Severity: normal Priority: P2 Component: directx-d3d AssignedTo: wine-bugs@winehq.org ReportedBy: descent1@gmx.net Classification: Unclassified
Created attachment 46195 --> http://bugs.winehq.org/attachment.cgi?id=46195 Console output
Note: This is about the new Bioshock 2 version on Steam (1.5.0.019) which has GFWL and SecuROM officially removed - no cracks have been used!
When playing single player in Bioshock 2 on highest settings, the game runs out of memory with this message: "err:d3d:resource_init Failed to allocate system memory."
I'm sure that I got this message as well a lot of times, but for some reason, the message is now different: "err:d3d_surface:surface_allocate_surface >>>>>>>>>>>>>>>>> GL_OUT_OF_MEMORY"
I've set my video RAM amount in the registry to 1024 MB which is correct for my GPU. If i decrease it to e.g. 768 MB, the game crashes a lot sooner.
See console output attached.
I tried those wine versions: 1.5.12, 1.6, 1.7.3
Tested on openSUSE 12.2 x86 NVidia GeForce GTX 460 (1024 MB RAM) using driver version 319.49
http://bugs.winehq.org/show_bug.cgi?id=34658
--- Comment #1 from Philipp Lorenz descent1@gmx.net 2013-10-04 13:53:27 CDT --- Created attachment 46197 --> http://bugs.winehq.org/attachment.cgi?id=46197 Console output with GL error
I was able to reproduce the GL_OUT_OF_MEMORY error now - see second attachment.
http://bugs.winehq.org/show_bug.cgi?id=34658
Travis Greenman cartman-2000@cartman-2000.net changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |cartman-2000@cartman-2000.n | |et
--- Comment #2 from Travis Greenman cartman-2000@cartman-2000.net --- I should try running Bioshock 2 on my 1.5gb gtx580, with nvidia-smi -l 3 running in the background to see how much vram is being used. I'm wondering if the game needs more than a GB of vram to run the game or if there's some kind of memory leak.
http://bugs.winehq.org/show_bug.cgi?id=34658
--- Comment #3 from Travis Greenman cartman-2000@cartman-2000.net --- Created attachment 46833 --> http://bugs.winehq.org/attachment.cgi?id=46833&action=edit Console output, with gl error and nvidia-smi output.
Tested, also able to reproduce, seems like the game can only allocate around 512mb of vram as it crashes at ~800mb of vram used(roughly 300-350mb of that is used by X and the DE/apps on my computer.).
Tried using different offscreen rendering modes, and set the ammount of vram with the reg options "OffscreenRenderingMode" and "VideoMemorySize", but they make no difference.
Wine version 1.7.4 with Pulse and CSMT patches, on getnoo linux with the 3.8.13 kernel and 325.15 nvidia drivers.
http://bugs.winehq.org/show_bug.cgi?id=34658
Thomas Luquet thomas@luquet.net changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |thomas@luquet.net
http://bugs.winehq.org/show_bug.cgi?id=34658
Leonard Leonard@sharklasers.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |Leonard@sharklasers.com
--- Comment #4 from Leonard Leonard@sharklasers.com --- Error still exists in the most recent version of Wine (WS9Wine1.7.13)
http://bugs.winehq.org/show_bug.cgi?id=34658
crt0mega@c-r-t.tk changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |crt0mega@c-r-t.tk
--- Comment #5 from crt0mega@c-r-t.tk --- Created attachment 48707 --> http://bugs.winehq.org/attachment.cgi?id=48707 "Failed to allocate system memory"
"err:ntdll:RtlpWaitForCriticalSection section 0x7c1dc44 "?" wait timed out in thread 005a, blocked by 0059, retrying (60 sec)" repeats every 60s.
wine 1.7.19 with pulseaudio patch
http://bugs.winehq.org/show_bug.cgi?id=34658
--- Comment #6 from ae crt0mega@c-r-t.tk --- still getting.....
err:d3d:resource_init Failed to allocate system memory.
....with wine version 1.7.22.
https://bugs.winehq.org/show_bug.cgi?id=34658
Ben Nemec nemecb@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |nemecb@gmail.com
--- Comment #7 from Ben Nemec nemecb@gmail.com --- Apparently 2 GB of vram is no help for this problem either. :-)
Just wanted to note that when I reproduced this while monitoring my GPU usage, I was only at about 500 MB used _total_. 167 MB is in use without the game running, so it had allocated quite a bit less than 512 in my case.
Also, not sure whether it's relevant, but the texture streaming in medium detail seems a little flaky. Sometimes textures just don't stream in at all, and other times they pop in well after I've approached an object. Probably unrelated, but I thought I'd mention it.
https://bugs.winehq.org/show_bug.cgi?id=34658
Johannes Brandstätter jbrandst@2ds.eu changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |jbrandst@2ds.eu
--- Comment #8 from Johannes Brandstätter jbrandst@2ds.eu --- Confirming this issue.
wine-1.7.25 on x86_64 NVidia GeForce GTX 780 3GB
https://bugs.winehq.org/show_bug.cgi?id=34658
David Finch david@mytsoftware.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |david@mytsoftware.com
https://bugs.winehq.org/show_bug.cgi?id=34658
scix55@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |scix55@gmail.com
--- Comment #9 from scix55@gmail.com --- Force enabling the Large Address Aware flag may help with the issue: http://www.ntcore.com/4gb_patch.php
Steam might not like it so a crack could be needed. I haven't tested this workaround with Bioshock 2 but I have with the first game and it works there. It also works with Resident Evil : Remastered but a crack is required for that game.
https://bugs.winehq.org/show_bug.cgi?id=34658
Jonas Jelten jj@stusta.net changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |jj@stusta.net
https://bugs.winehq.org/show_bug.cgi?id=34658
Gabriel Corona gabriel.corona@enst-bretagne.fr changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |gabriel.corona@enst-bretagn | |e.fr
--- Comment #10 from Gabriel Corona gabriel.corona@enst-bretagne.fr --- I tried patching the executable to add the LAA flag. However the game won't boot after that probably because of the Steam DRM. So I compiled a dedicated version of Wine which enforces the LAA (in virtual.c and heap.c, see the patch) and the game doesn't crash anymore.
https://bugs.winehq.org/show_bug.cgi?id=34658
--- Comment #11 from Gabriel Corona gabriel.corona@enst-bretagne.fr --- Created attachment 53156 --> https://bugs.winehq.org/attachment.cgi?id=53156 Enforce IMAGE_FILE_LARGE_ADDRESS_AWARE without changing the executable
This patch will break programs which are not LAA ready. You should not add it in your standard wine installation.
https://bugs.winehq.org/show_bug.cgi?id=34658
--- Comment #12 from ae crt0mega@c-r-t.tk --- Nvm, the game was running fine with Gallium-Nine.
https://bugs.winehq.org/show_bug.cgi?id=34658
Adam Bolte abolte@systemsaviour.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |abolte@systemsaviour.com
--- Comment #13 from Adam Bolte abolte@systemsaviour.com --- Confirming attachment 53156 applied against an otherwise clean 1.9.0 gets Dungeons Steam Edition working (after installing dotnet40 through winetricks).
Without this patch, Dungeons would show a black screen on loading a new level or simply crash with "GL_OUT_OF_MEMORY error generated. Failed to allocate memory for texture." and "err:d3d:resource_init Failed to allocate system memory." errors. Thanks Gabriel for the hack.
I also suspect bug 38200 is a duplicate of this report, but unfortunately I don't have the game it relates to (Space Engineers) to test and confirm.
https://bugs.winehq.org/show_bug.cgi?id=34658
Béla Gyebrószki gyebro69@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |gyebro69@gmail.com
https://bugs.winehq.org/show_bug.cgi?id=34658
--- Comment #14 from Gabriel Corona gabriel.corona@enst-bretagne.fr --- I made a cat /proc/$pid/map of Bioshock 2 (with the patch) (see the file in attachment) and it is using ~ 2973.61 MiB of virtual memory. For some reasons some .so files seem to appear multiple times. There are as well many occurences of things like this:
008d0000-008d1000 rwxp 00000000 00:00 0 008d1000-008e0000 ---p 00000000 00:00 0
https://bugs.winehq.org/show_bug.cgi?id=34658
--- Comment #15 from Gabriel Corona gabriel.corona@enst-bretagne.fr --- Created attachment 53373 --> https://bugs.winehq.org/attachment.cgi?id=53373 Memory map of BioShock 2 using 3GiB of virtual memory
https://bugs.winehq.org/show_bug.cgi?id=34658
--- Comment #16 from Gabriel Corona gabriel.corona@enst-bretagne.fr --- It looks like a *lot* of (possibly dead, unless the application is using fibers) stacks.
https://bugs.winehq.org/show_bug.cgi?id=34658
Wylda wylda@volny.cz changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |NEW Ever confirmed|0 |1 Keywords| |patch CC| |wylda@volny.cz
--- Comment #17 from Wylda wylda@volny.cz --- Confirming. DVD version can't no longer be activated online, so i tried Steam version.
Vanilla wine-1.9.13-114-gb1930ee freezes reliable always at the same place - cca 3 sec after starting a new game. Same message:
err:d3d:resource_init Failed to allocate system memory.
Patch/hack from Comment 11 fixes the issue for me. But i noticed, that it brings some compiler warning:
../../../wine_git_build/dlls/ntdll/virtual.c: In function ‘virtual_set_large_address_space’: ../../../wine_git_build/dlls/ntdll/virtual.c:1846:23: warning: unused variable ‘nt’ [-Wunused-variable] IMAGE_NT_HEADERS *nt = RtlImageNtHeader( NtCurrentTeb()->Peb->ImageBaseAddress );
Thank you Gabriel!
https://bugs.winehq.org/show_bug.cgi?id=34658
David Gámiz Jiménez david.gamiz@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |david.gamiz@gmail.com
--- Comment #18 from David Gámiz Jiménez david.gamiz@gmail.com --- Thanks Gabriel Corona!!
The patch run like a charm! :)
Why not in the main code right now???
Greetings! :)
https://bugs.winehq.org/show_bug.cgi?id=34658
--- Comment #19 from Gabriel Corona gabriel.corona@enst-bretagne.fr --- TLDR: my patch is a hack which might break other programs (I did not even bother to remove clearly the lines of codes bur horribly commented them out :/)
Wylda: Yes, the patch is a quick hack and might trigger some warnings :)
David: It's not merged because this patch is a hackish workaround which might break other programs.
By default Windows, 32-bit processes can use only the lower 2GiB of virtual memory. AFAIU, this is for compatibility/historical reason: some Windows programs may not work correctly with addresses above this limit (and ssumte they may be invalid or something).
Apparently, 2GiB is not enough for running Bioshock 2 on Wine in some cases: maybe it's because the OpenGL drivers use more virtual memory, maybe it's because some virtual memory is not properly deallocated, etc.
Windows .exe files can include a IMAGE_FILE_LARGE_ADDRESS_AWARE bit which removes this limitation: when this flag is set, a process can use more than 2GiB of virtual memory.
The patch enforces the IMAGE_FILE_LARGE_ADDRESS_AWARE behaviour on all processes. Biosock 2 can now use more than 2GiB of memory. This is a hack and you might not want this by default in a standard wine compilation because it might break programs which are not prepared to handle memory above the 2GiO limit. (In practice, I'm using this patch the time and I did not find any crash linked to this hack.)
The patch was intended as a quick workaround and proof of concept showing that the crash was due to do an exhaustion of the 2GiB virtual memory and not really to be merged (in its current form) in Wine source code.
Now what's needed is to find why this memory exhaustion is happening in the first place and try to fix that if possible. If a IMAGE_FILE_LARGE_ADDRESS_AWARE-enforcement feature is to be merged it should probably be optional (and disabled by default).
https://bugs.winehq.org/show_bug.cgi?id=34658
winetest@luukku.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |winetest@luukku.com
--- Comment #20 from winetest@luukku.com --- Maybe bug 33858 should be merged here and the title reformed to include the game. Also I believe there are more games like this that would need the patch.
https://bugs.winehq.org/show_bug.cgi?id=34658
Igor ikk_pl@yahoo.co.uk changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |ikk_pl@yahoo.co.uk
--- Comment #21 from Igor ikk_pl@yahoo.co.uk --- Created attachment 57561 --> https://bugs.winehq.org/attachment.cgi?id=57561 log for wine-2.3-109-g1ddf2b4
As of wine-2.3-109-g1ddf2b4, I'm able to play through the first couple minutes of the game until a most likely unrelated crash. I'm adding the log.
I was also able to get an interesting log for the bug from a wine-staging version applied to commit 0dc677c05fb71 - though didn't manage to reproduce it, so I didn't capture the log to a file. There are several instances of:
fixme:d3d_shader:shader_glsl_validate_link Program <number> link status invalid.
followed by a dump of the shader program, then hundreds of lines of:
err:d3d:wined3d_debug_callback 0x18a72550: "GL_INVALID_OPERATION error generated. <program> object is not successfully linked, or is not a program object.".
Maybe in the latest wine the shaders compile properly, so the bug is not triggered, or maybe Bioshock itself badly handles shaders that fail to compile? I'll leave that to the experts.
https://bugs.winehq.org/show_bug.cgi?id=34658
--- Comment #22 from Igor ikk_pl@yahoo.co.uk --- As of wine-2.12-205-g9118512135 (Staging), I'm able to play through the entire first section of the game (around 10 minutes, until the first airlock) with no crashes. The game hardlocks after using the airlock, though loading a save from right before using the airlock is a workaround. I think this bug is fixed, can someone else confirm?
https://bugs.winehq.org/show_bug.cgi?id=34658
--- Comment #23 from Igor ikk_pl@yahoo.co.uk --- The issue appears to still be present - I ran out of memory in the first larger area of the game (Pauper's Drop).
https://bugs.winehq.org/show_bug.cgi?id=34658
Daniel Scharrer dscharrer@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |dscharrer@gmail.com
https://bugs.winehq.org/show_bug.cgi?id=34658
tokktokk fdsfgs@krutt.org changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |fdsfgs@krutt.org
https://bugs.winehq.org/show_bug.cgi?id=34658
--- Comment #24 from Gabriel Corona gabriel.corona@enst-bretagne.fr --- Seen in the lateste release of Proton that they added support for forcing LAA with an environment variable (PROTON_FORCE_LARGE_ADDRESS_AWARE=1).
https://bugs.winehq.org/show_bug.cgi?id=34658
--- Comment #25 from Andrey Gusev andrey.goosev@gmail.com --- Attachment 53156 helps for Sebastien Loeb Rally EVO while using 32-bit version.
https://bugs.winehq.org/show_bug.cgi?id=34658
joaopa jeremielapuree@yahoo.fr changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |jeremielapuree@yahoo.fr
--- Comment #26 from joaopa jeremielapuree@yahoo.fr --- Does the bug still occur with wine-5.13?
https://bugs.winehq.org/show_bug.cgi?id=34658
mirh mirh@protonmail.ch changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |mirh@protonmail.ch
--- Comment #27 from mirh mirh@protonmail.ch --- I would guess so, given it sounds pretty close to bug 44375.
https://bugs.winehq.org/show_bug.cgi?id=34658
--- Comment #28 from joaopa jeremielapuree@yahoo.fr --- Does the bug still occur with wine-9.0?