PC Out of Memory Exception

x3n0ph0b3

Terrarian
I could really use some help with this one.

TL;DR my game crashes anywhere between a few hours and 10-15 minutes at a time.
It's an out of memory exception while trying to resize an array.

I've lost a few good Ankh components and have begun save/exiting after I do anything important, but it's becoming rather frustrating.

Here is a pastebin of all of my crash logs so far

Edit: After a great deal of experimentation it appears to be because I'm using either Retro or Trippy lighting. The memory self-regulates at around 790 MB when using color or white lighting, but Retro and Trippy cause it to steadily climb. The game crashes around 840 MB used.


Things worth noting:
  • The game version is 1.3.0.4
  • Crash still occurs on 1.3.0.5
  • Cloud synchronization is disabled already.
  • I'm on Windows 7.
  • I am NOT using recompiled source/exe, this is a vanilla binary in every possible way.
  • I am NOT using a 3rd party app, game launcher, mods, or anything of the kind.
  • I am NOT running in compatibility mode.
  • I am launching the game through steam.
  • Occurence of exception is seemingly random; from the logs you can see that the time between crashes can be hours at a time, or as little as roughly 10 minutes.
  • I haven't been able to deduce a specific trigger for the crash; "what I'm doing" at the time appears to be irrelevant.
  • Edit: World size is SMALL, Type is Expert. I am playing single player.

Things I've tried:
    • Only passes on a fresh install. According to a sticky thread, this is normal: one file fails and fails to be reacquired.
    • Q: Steam has reported that one (1) file has failed verification and was downloaded?
    • A: This file is known as the serverconfig.txt file. Originally this file shouldn't be packed with the game as Terraria should create this file automatically on launch if it is missing or out of date. Due to it being changed and updated by server owners, the file will constantly fail the verification process. This has no effect on playing the game, and can be ignored.
  • Deleting Local Content - Completely wiping the terraria steam app folder and redownloading/installing. Causes game cache to go back to passing verification, until the next time it is run.
  • Disabling Cloud Saves - As stated above, cloud syncs are disabled, the game still crashes
  • Running as administrator - still crashes
Things I'm going to try when I get home:
  • Move my Terraria install to the SSD so the saves are on the same drive. (Done)
  • Check my drivers for updates (Done)
  • Reinstall XNA (Done)
  • Check Avast for quarantine or blacklist files. (Nope) According to a few (reddit, steam, here) threads, Avast is throwing false positives on the Terraria executable.
  • Q: I am experiencing low frame rate for Terraria, but the machine passes as recommended?
    A: If you are using nVidia Control Panel, you can select Terraria.exe process and change the specifications on how your graphic card handles the game. Follow these instructions:
    Open nVidia Control Panel.
    Select Manage 3D Settings.
    Choose Program Settings Tab.
    Select Terraria as current program.
    Turn Triple buffering and Vertical sync to On.
    Run Terraria and turn Frame Skip to Off.
    The application should be running better than your current setup.

Option/settings:
  • Video frame skipping enabled
  • Multicore lighting disabled
  • Lighting trippy
  • Full screen Resolution 1920x1080

Hardware:
  • CPU i7 quad [chipset idk]
  • GPU Nvidia GTX 760
  • RAM 8 GB
  • HDs 128 GB SSD and 4 TB Hybrid Drive

Terraria saves/windows install is on a 128 GB SSD
Steam drive is on a 4 TB Hybrid Drive

Software:
  • .NET Framework 4.5.2, last I checked.
  • XNA installed, I forget the version. I will check it when I get home.
  • Terraria is through steam, it is very much a legal copy.

Any assistance or suggestions would be greatly appreciated.
 
Last edited:

x3n0ph0b3

Terrarian
Bump and notes:
I had the .NET framework 4.5.2 for work (I'm a .NET developer) and it appears to be a different version than the one Terraria wants to download by default (Framework 4 Client Profile and Framework 4 Extended). Not sure if the exact dependency matters, but it might.

I've reinstalled XNA, looks like it downloaded the same one I had already.

Moved my Terraria game directory to the C drive (Terraria gets to be special, the rest of my steam apps are on D).

Updated my video drivers to the latest for my card.

Tweaked my NVidia settings for Terraria optimization:
Open nVidia Control Panel.
Select Manage 3D Settings.
Choose Program Settings Tab.
Select Terraria as current program.
Turn Triple buffering and Vertical sync to On.
Run Terraria and turn Frame Skip to Off.
The application should be running better than your current setup.

The Avast quarantine did not contain a Terraria executable, so it looks like I'm not having the same Antivirus issues everyone else is. Binary is there and it's intact.

I will add to this post if the crash persists, with more information/logs.
 

x3n0ph0b3

Terrarian
Still crashing, even after all that stuff I did.

Same crash as before:
7/13/2015 6:07:34 PM
System.OutOfMemoryException: Exception of type 'System.OutOfMemoryException' was thrown.
at System.Array.Resize[T](T[]& array, Int32 newSize)
at Terraria.Graphics.TileBatch.InternalDraw(Texture2D texture, Vector4& destination, Boolean scaleDestination, Nullable`1& sourceRectangle, VertexColors& colors, Vector2& origin, SpriteEffects effects)
at Terraria.Graphics.TileBatch.Draw(Texture2D texture, Vector2 position, Nullable`1 sourceRectangle, VertexColors colors, Vector2 origin, Single scale, SpriteEffects effects)
at Terraria.Main.DrawBackground()
at Terraria.Main.Draw(GameTime gameTime)
at Microsoft.Xna.Framework.Game.DrawFrame()
at Microsoft.Xna.Framework.Game.Tick()
at Microsoft.Xna.Framework.Game.HostIdle(Object sender, EventArgs e)
at Microsoft.Xna.Framework.GameHost.OnIdle()
at Microsoft.Xna.Framework.WindowsGameHost.RunOneFrame()
at Microsoft.Xna.Framework.WindowsGameHost.ApplicationIdle(Object sender, EventArgs e)
at System.Windows.Forms.Application.ThreadContext.System.Windows.Forms.UnsafeNativeMethods.IMsoComponent.FDoIdle(Int32 grfidlef)
at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(IntPtr dwComponentID, Int32 reason, Int32 pvLoopData)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.Run(Form mainForm)
at Microsoft.Xna.Framework.WindowsGameHost.Run()
at Microsoft.Xna.Framework.Game.RunGame(Boolean useBlockingRun)
at Terraria.Program.LaunchGame(String[] args)

Edit: Suspicious, this seems to be tied to my lighting setting.
When I have the game set to Retro or Trippy, the memory slowly approaches approximately 840 MB and subsequently crashes. With white and color lighting, the memory seems stable. Will let you know more as I continue to experiment.
 
Last edited:

Bateman

Terrarian
upload_2015-7-14_2-30-17.png
Game crashes after 5-10 minutes showing me this error. Pls fixerino
 

x3n0ph0b3

Terrarian
View attachment 62944 Game crashes after 5-10 minutes showing me this error. Pls fixerino
Wow, finally someone with the same error. Try turning your lighting mode from trippy/retro to white/color. I have mine set to color and the crashing stopped (I prefer trippy). It looks like while it's on trippy/retro, the memory consumption slowly ramps up until the game thinks it has run out. My guess is they're aware of the lighting issues. Using the 2 [crappy] lighting options is my workaround for the time being. Trippy and retro are much cooler. :\
 

killzoid23

Terrarian
I got the same error about 4 times after 1.3, but never before. Luckily, I've only lost some construction. I've never played with white/color, since it gave me terrible fps back in 1.1, but I guess I'll try that until this gets fixed.
EDIT: I just got the error while loading into a world, even though I have the lighting on color
 
Last edited:

Merancapeman

Plantera
Only time I can get this to work is if I set the resolution to 800x600 for my friend who's having the issue. Is that the only fix? Or is this completely hardware based?
 

Yeti

Terrarian
Had/have the same issue. And solution above did help (turning color mode)
The wierd thing is - game was running perfectly for Normal playthrough + half of Hardmode, and then SUDDENLY this nasty crash occured. Dont know.
 

k73057

Terrarian
TerrariaCrash.png

Having the same issue. Win 7 (64-bit) 4GB RAM. Plenty of hard drive space and no cpu issues.
I usually can get the game going with Video background turned OFF and Video quality set to LOW. Resolution 1280x962, lighting COLOR. Sometimes can play for hours without a crash.
But today for some reason it crashes immediately after it finishes loading. I've tried launching several times to no avail.

I am trying to load a LARGE world, that is not saved to the cloud. I can successfully load a small world that I just created.

When it crashes I get the popup error screen. My perfmon shows Terraria exe memory consumption rapidly grows and at crash state, is top memory user with over 1,100,000KB.
When I start playing I'm careful not to have any other apps running. Today I even tried killing off some processes and stopping unnecessary services in order to free up more memory.
 

k73057

Terrarian
I was able to get past the out of memory crash by increasing my virtual memory page file size.
It was originally configured to be managed by windows and was allocated to around 4085 MB despite showing a recommended size of 6127MB.
Since I have a lot of available disk space I changed it to custom size with min of 6127 MB and max of 8170. I'm not an expert on this setting so please do your own research on its usage.

I also set resolution to 1280x1024 (my display's recommendation), color to Retro (yields smother movement for me), left quality LOW and background OFF, and Parallax zero. In addition I set Multicore lighting to 2 since I have a dual core cpu -- not that I noticed any difference.

Note that the game still crashes on occasion during play and sometimes on load, so I think there is still a memory leak that gets triggered under certain unknown conditions.

I haven't played extensively with this configuration change so not sure how successful it will be. If the crashes are still really frequent and disruptive I'll try to add another post.
 

x3n0ph0b3

Terrarian
I was able to get past the out of memory crash by increasing my virtual memory page file size.
It was originally configured to be managed by windows and was allocated to around 4085 MB despite showing a recommended size of 6127MB.
Since I have a lot of available disk space I changed it to custom size with min of 6127 MB and max of 8170. I'm not an expert on this setting so please do your own research on its usage.

I also set resolution to 1280x1024 (my display's recommendation), color to Retro (yields smother movement for me), left quality LOW and background OFF, and Parallax zero. In addition I set Multicore lighting to 2 since I have a dual core cpu -- not that I noticed any difference.

Note that the game still crashes on occasion during play and sometimes on load, so I think there is still a memory leak that gets triggered under certain unknown conditions.

I haven't played extensively with this configuration change so not sure how successful it will be. If the crashes are still really frequent and disruptive I'll try to add another post.

My "fix" was simply not to use retro/trippy lighting as they are responsible for the memory issue, pretty much single handedly. With white/color lighting I can max my resolution (1920 x 1080), max the texture quality, frame skipping off (vsync and triple buffering enabled in NVIDIA ctrl panel), no multicore lighting (not even sure what it does) and I'm crashless. The moment I turn on retro (my preferred lighting) or trippy (my second favorite), the memory issues return.

Also bear in mind at the time of the crash I'm nowhere near my ram's capacity, the game simply refuses to go beyond a certain point of memory usage. Speaking to Shockah/Poro/modders in general reveals that you can't uncap Terraria's throttled memory consumption. Increasing your page file is a supplemental allocation for memory usage, it would not fix this particular problem. I have ample RAM for Terraria to avail itself to, regardless of my page file size. Terraria is simply [strictly] limited in how much it can use.
 

killzoid23

Terrarian
x3n0ph0b3 said:
My "fix" was simply not to use retro/trippy lighting as they are responsible for the memory issue, pretty much single handedly. With white/color lighting I can max my resolution (1920 x 1080), max the texture quality, frame skipping off (vsync and triple buffering enabled in NVIDIA ctrl panel), no multicore lighting (not even sure what it does) and I'm crashless. The moment I turn on retro (my preferred lighting) or trippy (my second favorite), the memory issues return.
I've been playing with color, but I'm still getting the memory error (and some other random crashes, but I think those are related to my terrible computer). It doesn't seem to matter what settings I have on, it just seems to crash at random times. I can play for hours before it dies, or a couple minutes. It can crash when I'm loading into a world, or while I'm in it.
 

NotaVoltorb

Steampunker
Your specs are almost twice as good as mine and I still run a smooth 30 fps with color lighting and I have never experienced a crash from memory.
I cannot pinpoint a cause unfortunately.
 

Marcus101RR

Master of Ravens
The issue lies in XNA or .NET properly being installed, this is a major issue with windows systems as the true way to only resolve this is to wipe the harddrive and install both XNA and .NET to the latest verison before even considering to use any other application needed. I have tested this on VM machines, and on clean machines. XNA and .NET are tricky bastards, this isn't terraria's fault, its just the fact that it uses this crappy engine and sadly this crappy engine is very pansy about its procedure.

You can attempt to clean install both of these as is, or do a wipe. Fact is, something went wrong and Terraria is not getting what it needs from the system.
 
Top Bottom