- Home /
Huge memory usage textures
Hi all,
I have a 3D endless runner game running on iOS, Android and Windows Phone.
It works fine on Windows Phones with 1014MB memory and above, but under that it crashes as soon as it starts (see error message from Visual Studio at the bottom of this post).
Looking at the profiler I can see the memory usage for textures is extremely high, knowing that I only get a maximum of 180MB RAM on a Lumia 520 for example, I can see from the profiler that the textures take up 359MB alone, and even at eighth res (screenshot below) they still take up 232MB! I have gone through every texture making it as small and compressed as I can, am I doing something really wrong here? How can I find out more about what textures are problems?
I usually preload all the procedural level elements into memory at the start of the game to help the frame rate once you're running, but even when I turn this off completely the memory usage is unaffected.
Any pushes in the right direction would really help, thanks!
![memory usage][1]
Visual Studio crash console log dump:
'TaskHost.exe' (CLR C:\windows\system32\coreclr.dll: DefaultDomain): Loaded 'C:\windows\system32\mscorlib.ni.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'TaskHost.exe' (CLR C:\windows\system32\coreclr.dll: Silverlight AppDomain): Loaded 'C:\windows\system32\System.Windows.RuntimeHost.ni.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'TaskHost.exe' (CLR C:\windows\system32\coreclr.dll: Silverlight AppDomain): Loaded 'C:\windows\system32\System.Windows.ni.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'TaskHost.exe' (CLR C:\windows\system32\coreclr.dll: Silverlight AppDomain): Loaded 'C:\windows\system32\System.Net.ni.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'TaskHost.exe' (CLR C:\windows\system32\coreclr.dll: Silverlight AppDomain): Loaded 'C:\windows\system32\System.ni.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'TaskHost.exe' (CLR C:\windows\system32\coreclr.dll: Silverlight AppDomain): Loaded 'C:\windows\system32\System.Xml.ni.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'TaskHost.exe' (CLR C:\windows\system32\coreclr.dll: Silverlight AppDomain): Loaded 'C:\Data\Programs\{DFE540D3-80C1-4CFF-BFCA-CE252BC4EECE}\Install\EndlessRunner.DLL'. Symbols loaded.
'TaskHost.exe' (CLR C:\windows\system32\coreclr.dll: Silverlight AppDomain): Loaded 'C:\windows\system32\Microsoft.Phone.ni.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'TaskHost.exe' (CLR C:\windows\system32\coreclr.dll: Silverlight AppDomain): Loaded 'C:\windows\system32\Microsoft.Phone.Interop.ni.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'TaskHost.exe' (CLR C:\windows\system32\coreclr.dll: Silverlight AppDomain): Loaded 'C:\Data\Programs\{DFE540D3-80C1-4CFF-BFCA-CE252BC4EECE}\Install\WinRTBridge.DLL'. Cannot find or open the PDB file.
'TaskHost.exe' (CLR C:\windows\system32\coreclr.dll: Silverlight AppDomain): Loaded 'C:\Data\Programs\{DFE540D3-80C1-4CFF-BFCA-CE252BC4EECE}\Install\BridgeInterface.winmd'. Module was built without symbols.
'TaskHost.exe' (CLR C:\windows\system32\coreclr.dll: Silverlight AppDomain): Loaded 'C:\Data\Programs\{DFE540D3-80C1-4CFF-BFCA-CE252BC4EECE}\Install\UnityPlayer.winmd'. Module was built without symbols.
'TaskHost.exe' (CLR C:\windows\system32\coreclr.dll: Silverlight AppDomain): Loaded 'C:\windows\system32\WinMetadata\Windows.winmd'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'TaskHost.exe' (CLR C:\windows\system32\coreclr.dll: Silverlight AppDomain): Loaded 'C:\windows\system32\System.Core.ni.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'TaskHost.exe' (CLR C:\windows\system32\coreclr.dll: Silverlight AppDomain): Loaded 'C:\windows\system32\System.Runtime.ni.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
Build from 'release/4.5/release' branch, version is '4.5.0f6 (fd4616464986)' (Release build).
Physical memory: 395 MB, commited memory limit: 180 MB.
PlayerConnection initialized from C:/Data/Programs/{DFE540D3-80C1-4CFF-BFCA-CE252BC4EECE}/Install/Data (debug = 0)
PlayerConnection initialized network socket : 0.0.0.0 55444
Multi-casting "[IP] 192.168.0.19 [Port] 55444 [Flags] 2 [Guid] 93005236 [EditorId] 1016877170 [Version] 1048832 [Id] WP8Player(192.168.0.19) [Debug] 0" to [225.0.0.222:54997]...
Direct3D:
Version: Direct3D 11.0 [level 9.3]
Renderer: Qualcomm Adreno 305 (WDDM v1.2) (ID=0x30303330)
Vendor: Qualcomm
VRAM: 96 MB
Initialize engine version: 4.5.0f6 (fd4616464986)
'TaskHost.exe' (CLR C:\windows\system32\coreclr.dll: Silverlight AppDomain): Loaded 'C:\Data\Programs\{DFE540D3-80C1-4CFF-BFCA-CE252BC4EECE}\Install\UnityEngine.DLL'. Cannot find or open the PDB file.
'TaskHost.exe' (CLR C:\windows\system32\coreclr.dll: Silverlight AppDomain): Loaded 'C:\Data\Programs\{DFE540D3-80C1-4CFF-BFCA-CE252BC4EECE}\Install\Assembly-CSharp-firstpass.DLL'. Cannot find or open the PDB file.
'TaskHost.exe' (CLR C:\windows\system32\coreclr.dll: Silverlight AppDomain): Loaded 'C:\Data\Programs\{DFE540D3-80C1-4CFF-BFCA-CE252BC4EECE}\Install\Assembly-CSharp.DLL'. Cannot find or open the PDB file.
'TaskHost.exe' (CLR C:\windows\system32\coreclr.dll: Silverlight AppDomain): Loaded 'C:\Data\Programs\{DFE540D3-80C1-4CFF-BFCA-CE252BC4EECE}\Install\BFSWP8Goodies.DLL'. Cannot find or open the PDB file.
'TaskHost.exe' (CLR C:\windows\system32\coreclr.dll: Silverlight AppDomain): Loaded 'C:\Data\Programs\{DFE540D3-80C1-4CFF-BFCA-CE252BC4EECE}\Install\GPGSUtils.DLL'. Cannot find or open the PDB file.
'TaskHost.exe' (CLR C:\windows\system32\coreclr.dll: Silverlight AppDomain): Loaded 'C:\Data\Programs\{DFE540D3-80C1-4CFF-BFCA-CE252BC4EECE}\Install\WinRTLegacy.DLL'. Module was built without symbols.
Could not allocate memory: System out of memory!
Trying to allocate: 1398128B with 32 alignment. MemoryLabel: Texture
Allocation happend at: Line:411 in C:/BuildAgent/work/aeedb04a1292f85a/Runtime/Graphics/Texture2D.cpp
Memory overview
[ ALLOC_DEFAULT ] used: 5715133B | peak: 5715181B | reserved: 6570457B
[ ALLOC_GAMEOBJECT ] used: 43508B | peak: 43508B | reserved: 52731B
[ ALLOC_GFX ] used: 155628390B | peak: 155628390B | reserved: 155631656B
[ ALLOC_PROFILER ] used: 5028B | peak: 5028B | reserved: 12158B
Could not allocate memory: System out of memory!
Trying to allocate: 1398128B with 32 alignment. MemoryLabel: Texture
Allocation happend at: Line:411 in C:/BuildAgent/work/aeedb04a1292f85a/Runtime/Graphics/Texture2D.cpp
Memory overview
[ ALLOC_DEFAULT ] used: 5715133B | peak: 5715181B | reserved: 6570457B
[ ALLOC_GAMEOBJECT ] used: 43508B | peak: 43508B | reserved: 52731B
[ ALLOC_GFX ] used: 155628390B | peak: 155628390B | reserved: 155631656B
[ ALLOC_PROFILER ] used: 5028B | peak: 5028B | reserved: 12158B
(Filename: C:/BuildAgent/work/aeedb04a1292f85a/Runtime/Allocator/MemoryManager.cpp Line: 909)
The program '[2540] TaskHost.exe' has exited with code -2147483645 (0x80000003).
[1]: https://dl.dropboxusercontent.com/u/3615425/so_mem_usage.jpg
Hi , try to decrease texture quality, click on the texture>in the inspector view look for the $$anonymous$$ax Size setting and lower that to 256...see if that help but of course the texture will not be as nice looking in the game.. hope that helps.
Another idea is to try use less textures, not sure if that is possible for your game?
Answer by N1warhead · Sep 24, 2014 at 09:31 PM
If you're using certain extentions you'll end up with a bigger file size, I recommend you try all your textures in a Jpeg as a file that would take over a meg with a tga will only be like EXAMPLE - 115 Kilobytes... You'll loose a little quality due to compression.....
However, the best way to optimize any game is to Re-use as many textures as you can as it will help with performance dramatically.
One thing to look at as well, I'm not sure if Phones work the same way as computers, but make sure you actually have the allocated memory available because just as a computer, the computer automatically takes up a certain percentage doing what it needs to do to run. So just because something says it has EXAMPLE - 32 megs of ram on a phone, I don't know how much they have, but anyways. lets say it has 32 megs of ram, well yes technically it has 32 megs of ram, but the phone needs 18 of it to run all of it's system tasks. So you'll really end up having a total of - 14 megs of ram.
Hope this helped...