-1
\$\begingroup\$

When creating 2500 objects, I get a strange windows exception. It says the operation copmleted successfully at my constructor line. The program doesn't run or anything. I'm assuming it has something to do with memory. Each object has 32 indices and 8 vertices, so that 640,000 bytes or whatever vertices and indices are stored as. Any idea on how to fix this? Creating 25 objects works fine\

    System.ComponentModel.Win32Exception was unhandled
    Message=The operation completed successfully
    Source=System.Drawing
    ErrorCode=-2147467259
    NativeErrorCode=0
    StackTrace:
   at System.Drawing.Icon.Initialize(Int32 width, Int32 height)
   at System.Drawing.Icon..ctor(Type type, String resource)
   at Microsoft.Xna.Framework.WindowsGameWindow.GetDefaultIcon()
   at Microsoft.Xna.Framework.WindowsGameWindow..ctor()
   at Microsoft.Xna.Framework.WindowsGameHost..ctor(Game game)
   at Microsoft.Xna.Framework.Game.EnsureHost()
   at Microsoft.Xna.Framework.Game..ctor()
   at Cube_Chaser.Cube..ctor(GraphicsDevice graphicsDevice, Vector3 Position, Color Color) in C:\Users\daj\Desktop\Cube Chaser after removal of cubedrawable - Copy\Cube Chaser\Cube Chaser\Cube.cs:line 31
   at Cube_Chaser.Cube.CreateMap() in C:\Users\user\Desktop\Cube Chaser after removal of cubedrawable - Copy\Cube Chaser\Cube Chaser\Cube.cs:line 247
   at Cube_Chaser.Game1.LoadContent() in C:\Users\daj\Desktop\Cube Chaser after removal of cubedrawable - Copy\Cube Chaser\Cube Chaser\Game1.cs:line 86
   at Microsoft.Xna.Framework.Game.Initialize()
   at Cube_Chaser.Game1.Initialize() in C:\Users\daj\Desktop\Cube Chaser after removal of cubedrawable - Copy\Cube Chaser\Cube Chaser\Game1.cs:line 77
   at Microsoft.Xna.Framework.Game.RunGame(Boolean useBlockingRun)
   at Microsoft.Xna.Framework.Game.Run()
   at Cube_Chaser.Program.Main(String[] args) in C:\Users\user\Desktop\Cube Chaser after removal of cubedrawable - Copy\Cube Chaser\Cube Chaser\Program.cs:line 15
  InnerException: 
\$\endgroup\$
10
  • 1
    \$\begingroup\$ This really looks a lot like a "please debug my code for me" question but without any code. What have you tried? \$\endgroup\$ Jun 30, 2013 at 10:52
  • \$\begingroup\$ The only thing that makes a difference is the amount of cubes I have in my array. Right now I'm using a 10x10 but when I bump it up to 50x50 it crashes. Is there a limit on memory allowed in a list or array? \$\endgroup\$ Jun 30, 2013 at 10:59
  • \$\begingroup\$ A 50x50 array is 25 times larger than a 10x10 array. It would help to know the type of the array, to know how much memory it is using. \$\endgroup\$ Jul 1, 2013 at 4:21
  • \$\begingroup\$ Also, can you explain to us why your stack trace looks like that? Why is Cube..ctor calling into Game..ctor?? That doesn't make sense. \$\endgroup\$ Jul 1, 2013 at 4:24
  • 1
    \$\begingroup\$ Also, I notice your directory is called "Cube Chaser after removal of cubedrawable - Copy". You might consider using version control. For local use you can't really go past SVN. It is very simple to use, especially with TortoiseSVN. It will look after all the different revisions of your code, so you don't have to. \$\endgroup\$ Jul 1, 2013 at 4:28

1 Answer 1

0
\$\begingroup\$

By changing my Cube class so it did not inherit from Microsoft.Framework.Xna.Game I was able to make this work.

\$\endgroup\$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .