DynamicDisplayable memory leak?

In this forum we discuss the future of Ren'Py, both bug fixes and longer-term development. Pre-releases are announced and discussed here.
Post Reply
Message
Author
User avatar
jack_norton
Lemma-Class Veteran
Posts: 4084
Joined: Mon Jul 21, 2008 5:41 pm
Completed: Too many! See my homepage
Projects: A lot! See www.winterwolves.com
Tumblr: winterwolvesgames
Contact:

DynamicDisplayable memory leak?

#1 Post by jack_norton »

Haha today I'm going to spam the Renpy development section :D
I found a really strange bug. First of all, since my "RPG framework" is insanely complex (really pushing renpy to its limits) it might be my fault. However, I don't know if just using the standard renpy commands I can cause a memory leak? :shock:
The memory leaks happens if you use DynamicDisplayable. I use it for tooltips.

Code: Select all

init python:
    class Tooltip(object):
        def __init__(self,id):
            self.id=id;self.ok=None;self.bk=renpy.store.tipT
        def show(self):
            self.ok = True
            renpy.store.tipT=self.id
        def hide(self):
            if self.ok:
                renpy.store.tipT=self.bk
                self.ok = False

    def TTipMaster(st,at):
        mollusk=None
        mollusk=ui.frame(yalign=0.995,yminimum=16,ymaximum=16,xmaximum=1020, xminimum=1020,xfill=True,style="inv")
        ui.text(renpy.store.tipT,size=16,xalign=0.5)
        return mollusk, .2
init:
    image Toolz = DynamicDisplayable(TTipMaster)
then in my main battle loop I do: renpy.show("Toolz")
That's it - if I comment the show statement, everything works fine (but obviously I don't see a tooltip). If I leave the PC on with tooltip enabled, using windows Task Manager I see renpy.exe process that gradually eats more RAM, which usually means a memory leak. After some minutes (without doing anything) the game crashes, sometimes forcing a hard reset of the PC :(
I never noticed it before because when I am out of combat, somehow it resets, or when I use Shift+R to reload the code it also "resets".
As I said, might be some weird stuff I'm doing somewhere else in my code, but I never had a memory leak crash before in all my other customized renpy games... :(
Last edited by jack_norton on Thu Dec 30, 2010 9:20 am, edited 1 time in total.
follow me on Image Image Image
computer games

User avatar
jack_norton
Lemma-Class Veteran
Posts: 4084
Joined: Mon Jul 21, 2008 5:41 pm
Completed: Too many! See my homepage
Projects: A lot! See www.winterwolves.com
Tumblr: winterwolvesgames
Contact:

Re: DynamicDisplayable memory leak?

#2 Post by jack_norton »

Just wanted to add that I tried with a very simple renpy app that has just the lines above (plus obviously a button with associated tooltip) and I see the memory leak, so I'm fairly confident that it's a memory leak in that point. I am not sure if it's a bug in renpy dynamicdisplayable or in the way I use it...
follow me on Image Image Image
computer games

User avatar
PyTom
Ren'Py Creator
Posts: 16096
Joined: Mon Feb 02, 2004 10:58 am
Completed: Moonlight Walks
Projects: Ren'Py
IRC Nick: renpytom
Github: renpytom
itch: renpytom
Location: Kings Park, NY
Contact:

Re: DynamicDisplayable memory leak?

#3 Post by PyTom »

The problem here is that each call to ui.frame adds a new ui.frame to the screen. (Although since renpy.restart_interaction isn't called, it isn't shown.)

You need to call ui.detached before calling ui.frame, so it isn't added.
Supporting creators since 2004
(When was the last time you backed up your game?)
"Do good work." - Virgil Ivan "Gus" Grissom
Software > Drama • https://www.patreon.com/renpytom

User avatar
jack_norton
Lemma-Class Veteran
Posts: 4084
Joined: Mon Jul 21, 2008 5:41 pm
Completed: Too many! See my homepage
Projects: A lot! See www.winterwolves.com
Tumblr: winterwolvesgames
Contact:

Re: DynamicDisplayable memory leak?

#4 Post by jack_norton »

ah lol thanks, I didn't notice was added twice because the background was covering previous one!! :)
follow me on Image Image Image
computer games

Post Reply

Who is online

Users browsing this forum: No registered users