Page 1 of 1

Memory issue on Hardware Acceralation & Skipping

Posted: Fri Mar 29, 2013 9:27 am
by nyaatrap
I've been struggling ren'py's memory issue, and recently found there are 2 factors: hardware acceleration, and skipping.
Problem here is, hardware acceleration is system dependent. So I think I'd put my result here to ask someone to join investigating this issue further.

Firstly, This is the file I'm using to investigate memory issue:
memory_test.zip
(1023.81 KiB) Downloaded 29 times
After you launched it, press Tab key. Then image loading starts.
The code is following:

Code: Select all

init python:
    config.skip_delay = 0
    config.image_cache_size = 0
    
label splashscreen:
    jump start
    
label start:
    while True:
        python:
            for l in ["60", "50", "40"]:
                for k in ["1","2", "3"]:
                    for j in ["1","2","3","4","5", "6"]:
                        for i in ["a", "b", "c", "f", "l", "n", "p", "s", "z" ]:
                            renpy.scene()                        
                            renpy.show("image", at_list=[truecenter], what=im.Composite((935,1280),
                                (0,0), "large/rio%s.png"%l, (0,0), "large/rio_%s.png"%i,
                                (0,0), "large/rio_x%s.png"%j, (0,0), "large/rio_xx%s.png"%k))
                            narrator("")
I tried various combination of config.skip_delay and config.image_cache_size, changing software/hardware renderer.
The following data is with Windows 7, Core i3, Intel HD graphics 4000 (the driver version is 2013 one)
・When I use software renderer, and skip_delay = 200, and image_cache_size=0, RAM usage is stable around 70~90MB.
・When I use software renderer, and skip_delay = 25 (default), and image_cache_size = 0, It never release RAM and crashes soon.
・When I use hardware renderer, skip_delay = 25, image_cache_size=0, It's stable at 170~190MB. But when I minimize the window, it becomes 100mMB.
・When I use hardware renderer, skip_delay = 25, image_cache_size=8(default), It's stable around 400MB. But when I minimize the window, it becomes 100MB.
・When I use hardware renderer, skip_delay =0, image_cache_size = 0, It never release RAM and crashes soon. This setting also has interesting result. When I stop skipping before crash, like 1600MB usage, it becomes 800MB. And this 800MB becomes permanent RAM usage even I reload the game, restart the game, e.t.c. But when I minimize the window, it becomes 100MB.

Re: Memory issue on Hardware Acceralation & Skipping

Posted: Fri Mar 29, 2013 9:38 am
by jack_norton
Tried it on my PC which is similar to yours:
Windows 7, Core i3, ATi Radeon 4670 in HW accelerated mode
on 6.15 - memory goes up, if I stop skipping "some" of it gets released, seems 50%
on 6.13 & 6.14 - the memory usage was going always up even if I stopped skipping, so it means the bug was present also in previous version and is not a new thing of the latest update

Re: Memory issue on Hardware Acceralation & Skipping

Posted: Sat Mar 30, 2013 12:39 pm
by PyTom
I'm unable to reproduce this on 6.15.3.

6.15.3 will kick off the preload thread in a lot more cases, so I think it's at least possible it may have fixed this bug.

Re: Memory issue on Hardware Acceralation & Skipping

Posted: Sat Mar 30, 2013 12:47 pm
by jack_norton
Not sure if can help, in my case I didn't use the SKIP button, since skipping didn't advance the frames, I pressed the spacebar quickly and noticed the memory kept increasing until I stopped it.

Re: Memory issue on Hardware Acceralation & Skipping

Posted: Sat Mar 30, 2013 7:59 pm
by nyaatrap
Tested with my game AAA. With 6.15.2, it consumed 1000~1500 MB. But now with 6.15.3, it's stable around 900 MB. It improved significantly :D