C++ loading large images slows down program?

I am loading around 5 images 512/512 pixels each and I change those images around, after I change those images around like 20+ times, my program just lags badly and eventually stops running. What am I doing wrong here's part of the code.

1
2
3
4
5
6
7
8
9
10
11
12
 if (n==1)
         {
          back1 =  SDL_LoadBMP("data/images/1.bmp");
          SDL_BlitSurface (back1, NULL, screen, &backCord);
          SDL_FreeSurface (back1);
          }
           if (n==2)
         {
          back1 =  SDL_LoadBMP("data/images/2.bmp");
          SDL_BlitSurface (back1, NULL, screen, &backCord);
          SDL_FreeSurface (back1);
          }



Using SDL, DevC++, Windows Vista
Thanks
Topic archived. No new replies allowed.