Python pygame continuos image loading FPS
Question: Using pygame on a linux machine, continuously loading new images and
displaying them slows down the program.

The input images (400x300) are in PPM format to keep the file size constant
(360K) - not to affect IO and avoid any decompression delays.

It starts off at 50 frames per second and then after around 2 minutes its
around 25 frames per second.

    
    
    import pygame    
    pygame.init()    
    clock = pygame.time.Clock()
    screen = pygame.display.set_mode((800, 600),pygame.FULLSCREEN)   
    frame=1
    
    while 1:
    
        image = pygame.image.load(str(frame)+".ppm")    
    
        screen.blit(image,(0,0))
        pygame.display.flip()
    
        clock.tick(240)
    
        frame=frame+1
        if(frame%10==0):
            print(clock.get_fps())
    

What can be done to keep the frame rate more consistent?

Most likely it has something to do with old references to images that need to
be garbage collected. Maybe not.

Is there anyway to load images continuously without creating new objects and
triggering the garbage collector or whatever is slowing the system down?


Answer: After many weeks of pondering, I think I finally figured out what your problem
is. For some reason, the computer must be remembering the old values of
`image`. After the line that blits, put

    
    
    del image
    

I'm not entirely sure, but it might work.

