Memory management?
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.
- ktalkimist
- Veteran
- Posts: 216
- Joined: Fri Oct 19, 2012 10:28 pm
- Contact:
Memory management?
Is there a way to optimize memory? We've found that our game eats a lot of memory even when you're not doing anything. It would start at 400MB and reach nearly 1.5GB memory consumption by simply moving from one screen to another and talking to people.
- nyaatrap
- Crawling Chaos
- Posts: 1824
- Joined: Mon Feb 13, 2012 5:37 am
- Location: Kimashi Tower, Japan
- Contact:
Re: Memory management?
Did you update ren'py?
It's a bug before 6.16.3.
It's a bug before 6.16.3.
- ktalkimist
- Veteran
- Posts: 216
- Joined: Fri Oct 19, 2012 10:28 pm
- Contact:
Re: Memory management?
Will it fix the problem for distribution builds? We never really upgraded from 6.16.1.
Re: Memory management?
It will if you build them from 6.17.x...
- ktalkimist
- Veteran
- Posts: 216
- Joined: Fri Oct 19, 2012 10:28 pm
- Contact:
Re: Memory management?
Tried and we still have the same problem. Same memory consumption, but now it goes up only when you interact with the environment or enter a new area. Once you leave a memory-intensive area, memory consumption doesn't go down. Is there any way to remedy this without downscaling everything?xela wrote:It will if you build them from 6.17.x...
Re: Memory management?
I've thoroughly tested several memory leaks/overflows in a fairly complex game, so far it's always been not fully thought through/bad programming on my part. There is a good chance there is a flaw in yours as well...
- ktalkimist
- Veteran
- Posts: 216
- Joined: Fri Oct 19, 2012 10:28 pm
- Contact:
Re: Memory management?
Is this within Ren'py? Any tips? Our programmer isn't quite sure yet how to go about memory management on Ren'py.
Re: Memory management?
Obviously within Ren'Py... Once I've cached actual images (as displayable) instead of imagepaths that caused out of memory errors after playing for some time. At other time I didn't hide images or screens that were called from python with random tags, that resulted in something similar.
There is nothing you can do to "manage" memory in Ren'Py, other then running free memory function or possibly disabling part of functionality/using simpler resources. Python doesn't offer much in controlling allocated memory either... Basically the rule of a thumb should be that if you have memory leaks/overflows on a Ren'Py version where others have none, the fault lies somewhere in your code or misusing/misunderstanding Ren'Py somehow (basically the same thing).
There isn't much advice to be given without access to the code that may be at fault I am afraid.
There is nothing you can do to "manage" memory in Ren'Py, other then running free memory function or possibly disabling part of functionality/using simpler resources. Python doesn't offer much in controlling allocated memory either... Basically the rule of a thumb should be that if you have memory leaks/overflows on a Ren'Py version where others have none, the fault lies somewhere in your code or misusing/misunderstanding Ren'Py somehow (basically the same thing).
There isn't much advice to be given without access to the code that may be at fault I am afraid.
- ktalkimist
- Veteran
- Posts: 216
- Joined: Fri Oct 19, 2012 10:28 pm
- Contact:
Re: Memory management?
Yeah, we're considering downscaling the remaining resources as a last resort (already optimized the sprites). We use imagepaths and we do hide images/screens. Gonna have our programmer post actual code in a few minutes. Not sure what we're doing wrong. One issue we want to address is memory consumption that doesn't go down after leaving a memory-intensive area.
Thanks for the cool input!
Thanks for the cool input!
-
- Eileen-Class Veteran
- Posts: 1258
- Joined: Fri Sep 21, 2007 7:13 am
- Projects: a battle engine
- Contact:
Re: Memory management?
I don't think that's an issue, unless the increases are cumulative (in which case it really is leaking memory). Plenty of other apps do the same thing.ktalkimist wrote:One issue we want to address is memory consumption that doesn't go down after leaving a memory-intensive area.
The only thing that really matters is that peak usage, because the user might not have enough memory for that (particularly under Android) - average usage doesn't really matter when it comes to memory.
Re: Memory management?
I didn't actually suggest downscaling of resources to fix your problem. It's one way of lowering memory consumption but your could have a game with access to 100 000 images and it still might use below 250Mb of memory as long as you don't load to much of the resources simultaneously.
-
- Eileen-Class Veteran
- Posts: 1258
- Joined: Fri Sep 21, 2007 7:13 am
- Projects: a battle engine
- Contact:
Re: Memory management?
One good way of lowering memory usage is to significantly cut down the image cache.
You will pay for this in performance, but it might not be a problem for your game.
config.image_cache_size = 2
or
config.image_cache_size = 1
This can have a serious impact if your game has a high logical resolution (config.screen_width/height) - but you might be best off not touching it if the change in memory usage is unimpressive, because it will severely impact ren'py's ability to do work in the background making your game run smoothly.
You will pay for this in performance, but it might not be a problem for your game.
config.image_cache_size = 2
or
config.image_cache_size = 1
This can have a serious impact if your game has a high logical resolution (config.screen_width/height) - but you might be best off not touching it if the change in memory usage is unimpressive, because it will severely impact ren'py's ability to do work in the background making your game run smoothly.
- ktalkimist
- Veteran
- Posts: 216
- Joined: Fri Oct 19, 2012 10:28 pm
- Contact:
Re: Memory management?
Alright, we really have to lower both average and peak then, I think. Because it peaks at around 1.4GB and averages at 1GB after that, which might be too much for some people.Asceai wrote:I don't think that's an issue, unless the increases are cumulative (in which case it really is leaking memory). Plenty of other apps do the same thing.ktalkimist wrote:One issue we want to address is memory consumption that doesn't go down after leaving a memory-intensive area.
The only thing that really matters is that peak usage, because the user might not have enough memory for that (particularly under Android) - average usage doesn't really matter when it comes to memory.
Re: Memory management?
My game crashes at 1.4GB... But only way I got there in the first place was a bad approach to caching images that were drawn from a random pool to be displayed on the screen (screen language).ktalkimist wrote:Alright, we really have to lower both average and peak then, I think. Because it peaks at around 1.4GB and averages at 1GB after that, which might be too much for some people.Asceai wrote:I don't think that's an issue, unless the increases are cumulative (in which case it really is leaking memory). Plenty of other apps do the same thing.ktalkimist wrote:One issue we want to address is memory consumption that doesn't go down after leaving a memory-intensive area.
The only thing that really matters is that peak usage, because the user might not have enough memory for that (particularly under Android) - average usage doesn't really matter when it comes to memory.
Edit:
I don't think you can reach that during normal operations unless you're using Ren'Py for something seriously insane
My guess would be is that you're NOT caching paths somewhere but actually caching displayable instead. This behavior is TOO similar to what happened to me... 1GB = Normal operation, 1.3 - 1.5(crash) on the peak. Now same game runs at below 0.25 GB at all times (testing with 1125 very advanced (logically) characters and 20 000 images loaded into custom database class).
- AlfieMachica123
- Regular
- Posts: 56
- Joined: Sun Jun 30, 2013 10:15 pm
- Contact:
Re: Memory management?
am sorry, but am a dumb programmer, really
but can you explain (even just a little bit) what does "caching paths" and "caching displayable" mean,
heres what is happening
we have two places, each has a background image(ATL) one having 2(frames) and the other having 10(frames)
about what i am talking about, this is how i roll(code) with it,
let's just say that this is the ATL for the background image:
so uhmm, can i ask, where does this "caching paths" or this "caching displayable" come in
how do i do this the other way around?
anyway, thanks for every suggestions and comments, ^^
but can you explain (even just a little bit) what does "caching paths" and "caching displayable" mean,
heres what is happening
we have two places, each has a background image(ATL) one having 2(frames) and the other having 10(frames)
about what i am talking about, this is how i roll(code) with it,
Code: Select all
label dubidumbdumb:
if qmu_dubidumbdumb:
scene BGdubidumbdumb with Dissolve(0.3) ##background image(ATL)
$ qmu_dubidumbdumb = False
call screen SCdubidumbdumb ##screen set of imagebuttons
$ rst1 = _return
if rst1 == "mo1":
dumb_person "let's go to dubidumbdumb2"
$ qmu_dubidumbdumb = True
jump dubidumbdumb2
elif rst1 == "mo2":
dumb_person "let's go to dubidumbdumb3"
$ qmu_dubidumbdumb = True
jump dubidumbdumb3
else:
dumb_person "oops, i poked [rst1]"
dumb_person "what shoud i do with [rst1]?"
jump dubidumbdumb
Code: Select all
init:
python:
place_of_BGdubidumbdumb = "dubidumbdumb/folder/bg/"
image BGdubidumbdumb:
(place_of_BGdubidumbdumb + "1.png") ##1920 x 1080 jpg picture
5.00
(place_of_BGdubidumbdumb + "2.png" ##same size jpg picture
5.00
repeat
how do i do this the other way around?
anyway, thanks for every suggestions and comments, ^^
Who is online
Users browsing this forum: No registered users