Due to a post in a demo thread for my dungeon crawler I'm currently trying to find out where some unexpected memory usage could come from. Due to my (bad) experiences with garbage collection in other languages I'm wondering if that could be the cause here (the documentation I found about python garbage collection doesn't tell me how good / efficient it is or how often it is normally run ).
So basically what I'm doing is this
1.) I'm loading images from the disk during initialization
2.) Ingame I'm showing the same image at different locations on screen under different tags (but at the beginning I'm using renpy.scene() before beginnign to draw the images)
3.) I'm waiting until the user cliks on an image button (on a screen) or presses a specific key until I go back to 2.)
I'm NOT using gc.collect or anything.
Seemingly the memory allocation varies quite greatly so the question is can point 2 be the cause for it so that point 2 is triggered multiple times without the memory used in between beeing freed again? (thus using up more and more memory instead of about the same amount?)
Showing images and memory
Forum rules
This is the right place for Ren'Py help. Please ask one question per thread, use a descriptive subject like 'NotFound error in option.rpy' , and include all the relevant information - especially any relevant code and traceback messages. Use the code tag to format scripts.
This is the right place for Ren'Py help. Please ask one question per thread, use a descriptive subject like 'NotFound error in option.rpy' , and include all the relevant information - especially any relevant code and traceback messages. Use the code tag to format scripts.
Re: Showing images and memory
On my machine, your demo starts at ~720MB internal memory and eventually stabilizes at ~900MB. There are no noticeable garbage collection pauses. In fact, it doesn't seem like any images ever get unloaded.
-
- Miko-Class Veteran
- Posts: 745
- Joined: Fri Nov 02, 2012 8:41 am
- Projects: Red eyes in the darkness
- Contact:
Re: Showing images and memory
the enver get unloaded makes sense in a way as all images are pre loaded but the increase by 180 MB DURING play is something I'm not getting. do you have any idea there? (like I said the way I do things is just those 3 points above)
- nyaatrap
- Crawling Chaos
- Posts: 1824
- Joined: Mon Feb 13, 2012 5:37 am
- Location: Kimashi Tower, Japan
- Contact:
Re: Showing images and memory
If you're using renpy.cache_pin, I suggest you better not to use it as possible as you can. In my experience, it likely causes memory issue.
One more advice is use Transform a lot. For example, right side of the screen should be shown with Transform("left_side_image", xzoom=-1), so memory usage will be half. Using smaller textures with Transform zoom is another idea.
One more advice is use Transform a lot. For example, right side of the screen should be shown with Transform("left_side_image", xzoom=-1), so memory usage will be half. Using smaller textures with Transform zoom is another idea.
-
- Miko-Class Veteran
- Posts: 745
- Joined: Fri Nov 02, 2012 8:41 am
- Projects: Red eyes in the darkness
- Contact:
Re: Showing images and memory
never used renpy.cache_pin . what is that?
will look into the transformations there (maybe I can save loading both right and left side there [need to look how it impacts performance if I do that on the fly]) tnx
will look into the transformations there (maybe I can save loading both right and left side there [need to look how it impacts performance if I do that on the fly]) tnx
- nyaatrap
- Crawling Chaos
- Posts: 1824
- Joined: Mon Feb 13, 2012 5:37 am
- Location: Kimashi Tower, Japan
- Contact:
Re: Showing images and memory
It's a function to load images permanently over config.cache_size. This should be used on only UI images.Wolf wrote:never used renpy.cache_pin . what is that?
Ren'py records many data for rollback and some others. It's better to keep at least 200mb free RAM space for it in a complicated program.the enver get unloaded makes sense in a way as all images are pre loaded but the increase by 180 MB DURING play is something I'm not getting. do you have any idea there? (like I said the way I do things is just those 3 points above)
-
- Miko-Class Veteran
- Posts: 745
- Joined: Fri Nov 02, 2012 8:41 am
- Projects: Red eyes in the darkness
- Contact:
Re: Showing images and memory
Hmm interesting. The game uses 528-576 MB for me. when I put up gc.collect() at the end of each rendering that is reduced to 430-491 MB
Who is online
Users browsing this forum: Ahrefs [Bot], Bing [Bot]