Author Topic: System.OutofMemoryException  (Read 2211 times)

Offline UberJumper

  • Newbie Mark III
  • *
  • Posts: 38
System.OutofMemoryException
« on: April 23, 2010, 09:38:37 pm »
4/23/2010 9:28:10 PM (3.1.0.3)
-----------------------------------Application_ThreadException-----------------------------------System.OutOfMemoryException: Exception of type 'System.OutOfMemoryException' was thrown.
   at System.Number.FormatInt32(Int32 value, String format, NumberFormatInfo info)
   at AIWar.PlanetarySummary.Render(Direct3DRenderer R) in C:\vcprojs\AIWar\Framework\PlanetarySummary.cs:line 806
   at AIWar.GameForm.DrawDirect3D() in C:\vcprojs\AIWar\GameFormParts\GamePanel.cs:line 2940
   at AIWar.GameForm.RunNextCycle(Boolean DoRendering, Boolean DoScrollingAndInput) in C:\vcprojs\AIWar\GameFormParts\GameLoop.cs:line 2062
   at AIWar.GameForm.gameLoop() in C:\vcprojs\AIWar\GameFormParts\GameLoop.cs:line 294
   at AIWar.GameForm.GameForm_Load(Object sender, EventArgs e) in C:\vcprojs\AIWar\GameFormParts\Startup.cs:line 276
   at System.Windows.Forms.Form.OnLoad(EventArgs e)
   at System.Windows.Forms.Form.OnCreateControl()
   at System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)
   at System.Windows.Forms.Control.CreateControl()
   at System.Windows.Forms.Control.WmShowWindow(Message& m)
   at System.Windows.Forms.Control.WndProc(Message& m)
   at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
   at System.Windows.Forms.ContainerControl.WndProc(Message& m)
   at System.Windows.Forms.Form.WmShowWindow(Message& m)
   at System.Windows.Forms.Form.WndProc(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
   at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)


This occurs every time when an AI dies, and the massive AI Avenger spawns. I gave up and tried a new game, and basically just cheated my self a few golems and killed an AI command center, same problem happens. The game does not even touch all the memory i have available.

My specs:

Q6700 / 6 Gigs Ram / RadeonHD4890 / Windows Vista 64bit


Offline x4000

  • Chris McElligott Park, Arcen Founder and Lead Dev
  • Arcen Staff
  • Zenith Council Member Mark III
  • *****
  • Posts: 31,651
Re: System.OutofMemoryException
« Reply #1 on: April 23, 2010, 10:08:13 pm »
It's a 32bit program, so limited to 2gb of RAM.  There are details around on that in a few posts on the forum about why, but the short answer is that it's for performance and compatibility reasons.  Can you post a save that can be used to trigger the exception like you were describing, if you still have it?  We haven't run into that ourselves, and this is the only report we have of it so far, so I'm not sure what the specific circumstances of that savegame are that are causing this.  Thanks for the report!
Have ideas or bug reports for one of our games?  Mantis for Suggestions and Bug Reports. Thanks for helping to make our games better!

Offline UberJumper

  • Newbie Mark III
  • *
  • Posts: 38
Re: System.OutofMemoryException
« Reply #2 on: April 23, 2010, 10:22:38 pm »
It's a 32bit program, so limited to 2gb of RAM.  There are details around on that in a few posts on the forum about why, but the short answer is that it's for performance and compatibility reasons.  Can you post a save that can be used to trigger the exception like you were describing, if you still have it?  We haven't run into that ourselves, and this is the only report we have of it so far, so I'm not sure what the specific circumstances of that savegame are that are causing this.  Thanks for the report!

Hi, i can trigger it very easily by making a new game, and basically just cheating my self to one of the enemies V planets, and just cheat my self uber units, and kill the enemy command center. Once the avenger spawns  the game crashes for me.

I would also just like to say this is using the most recent beta as of today =s. I can hopefully get you the save on Monday, if you need more help.


Offline x4000

  • Chris McElligott Park, Arcen Founder and Lead Dev
  • Arcen Staff
  • Zenith Council Member Mark III
  • *****
  • Posts: 31,651
Re: System.OutofMemoryException
« Reply #3 on: April 24, 2010, 02:34:57 am »
Very peculiar.  I just tested it with the attached save, and there was no issue whatsoever.  Others have also been using the avenger with success, so whatever this is must be some really specific confluence of events in your particular save.  If you can post that at some point when you have a chance, that would be really helpful.  Thanks again for the report!
Have ideas or bug reports for one of our games?  Mantis for Suggestions and Bug Reports. Thanks for helping to make our games better!

Offline keith.lamothe

  • Arcen Games Staff
  • Arcen Staff
  • Zenith Council Member Mark III
  • *****
  • Posts: 19,505
Re: System.OutofMemoryException
« Reply #4 on: April 24, 2010, 10:37:52 am »
Weird.  I guess in theory it could bug out creating an infinite number of modules during the spawn, but I don't see how that would happen on one machine and not others.

And the actual allocation that died was in planetary summary formatting an int as a string (meaning that it was not the culprit for massive memory allocation), so it's not like it got stuck in a tight spin creating modules and dying there.

If we're able to reproduce the problem I can run the avenger-spawn timeslice through the profiler and get a very clear idea of what's being allocated where; but that can take an hour or more even on good hardware so I'd like a concrete reproducible case before I do that.
Have ideas or bug reports for one of our games? Mantis for Suggestions and Bug Reports. Thanks for helping to make our games better!

Offline UberJumper

  • Newbie Mark III
  • *
  • Posts: 38
Re: System.OutofMemoryException
« Reply #5 on: April 26, 2010, 04:13:08 pm »
Very peculiar.  I just tested it with the attached save, and there was no issue whatsoever.  Others have also been using the avenger with success, so whatever this is must be some really specific confluence of events in your particular save.  If you can post that at some point when you have a chance, that would be really helpful.  Thanks again for the report!

Hi i tried your save game and i get the crash immediately when the golems kill the AI command center and the avenger spawns. i was able to reproduce it 3 out of 3 times.

However updating to the new beta patch 3.111 this no longer occurs. ;D


Offline x4000

  • Chris McElligott Park, Arcen Founder and Lead Dev
  • Arcen Staff
  • Zenith Council Member Mark III
  • *****
  • Posts: 31,651
Re: System.OutofMemoryException
« Reply #6 on: April 26, 2010, 04:21:01 pm »
Very odd!  Well, I guess it was just some bug in an older version -- glad it's resolved, at least!
Have ideas or bug reports for one of our games?  Mantis for Suggestions and Bug Reports. Thanks for helping to make our games better!

Offline keith.lamothe

  • Arcen Games Staff
  • Arcen Staff
  • Zenith Council Member Mark III
  • *****
  • Posts: 19,505
Re: System.OutofMemoryException
« Reply #7 on: May 03, 2010, 10:54:54 pm »
Ok, ran a intensive profile of your _avenger save from shortly before the destruction of the ai home command station til sometime quite a bit later, and found no worrisome memory allocation behavior.  It peaked at around 120MB of managed objects, before dropping to < 50MB and staying around there.

Was worth running though, I found that ~46% of all memory allocation was string.concat in AITactics.ShipCombatTactics; easily fixed.  It was transient rather than persistent memory allocation, of course, but when you're talking 670MB over half an hour, it can add up in terms of garbage collection time and whatnot.
Have ideas or bug reports for one of our games? Mantis for Suggestions and Bug Reports. Thanks for helping to make our games better!