Very strange error

My code compiles correctly (though with a suspiciously low size reported--400 bytes, when I'm using libraries that should be upwards of 10000 bytes), and uploads fine, but the arduino (a Mega2560) proceeds to do nothing at all, except light its L and TX (and of course power) LEDs.

Please help? I don't understand this in the least. If it helps any, this is supposed to do a simple GoL output on a TV screen.

#include <TVout.h>
#include <video_gen.h>

boolean main[120][96];
int surroundings[120][96];
TVout tv;

void setup()
{
  randomSeed(analogRead(0));
  for(int x = 0; x < 119; x++)
  {
    for(int y = 0; y < 95; y++)
    {
      main[x][y] = random(0, 1);
    }
  }
  tv.begin(NTSC, 120, 96);
}

void loop()
{
  for(int x = 0; x < 119; x++)
  {
    for(int y = 0; y < 95; y++)
    {
      if(main[x][y] == 1)
      { tv.set_pixel(x, y, WHITE); }
      else
      { tv.set_pixel(x, y, BLACK); }
    }
  }
  for(int x = 0; x < 119; x++)
  {
    for(int y = 0; y < 95; y++)
    {
      int surr = 0;
      int xp; int yp; int xm; int ym;
      if(x == 0) {
        xp = 1;
        xm = 119;
      }
      else if(x == 119) {
        xp = 0;
        xm = 118;
      }
      else {
        xp = x + 1;
        xm = x - 1;
      }
      
      if(y == 0) {
        yp = 1;
        ym = 95;
      }
      else if(y == 95) {
        yp = 0;
        ym = 94;
      }
      else {
        yp = y + 1;
        ym = y - 1;
      }
      surr += main[xp][y];
      surr += main[xm][y];
      surr += main[xp][yp];
      surr += main[xm][yp];
      surr += main[xp][ym];
      surr += main[xm][ym];
      surr += main[x][yp];
      surr += main[x][ym];
      
      surroundings[x][y] = surr;
    }
  }
  for(int x = 0; x < 119; x++)
  {
    for(int y = 0; y < 95; y++)
    {
      if(surroundings[x][y] == 3)
      { main[x][y] = 1; }
      else if(surroundings[x][y] != 2 && surroundings[x][y] != 3)
      { main[x][y] = 0; }
    }
  }
}

Your two arrays take up about 34,500 bytes, but there's only 8kB of SRAM.
You're going to have to figure out some other way to do this.

Pete

Oh, perhaps I can store them in flash?
(using an Arduino mega, so there's plenty of room)

Or I could even use the screen buffer as a storage medium...

You can put large arrays in flash but only if they have constant values. Flash memory is not writable while your program is running.

Pete

Or I could even use the screen buffer as a storage medium.

Those arrays are your screen buffer, aren't they?

I'm referring to using the tv.get_pixel(x, y) function--it returns the current color of the pixel.