Python pickle module renpy saving?

Ok so i understand that renpy uses the pickle module for saving. Admittedly my game is probably abnormal in that it spawns lots of things into memory that need to be saved for a renpy game at 1gb+. I’m working on tuning the count of objecs to mange this number i have tuned it as high as 6gb and as low as .5gb. However something i have noticed is memory usage of my renpy game quadruples while the pickle module is saving a game. Is this normal. I’m gussing this is the pickle module? Can pickle be tuned in renpy? I have concerns that my memory budget for the game is going to have to take into consideration the pickle module ballooning the programs size in memory while saving.

Also this memory does not seem to get released after saving, according to my system, weather this is allocation now unused or things staying in memory.

While I don’t know about the specifics of Python/Ren’py/Pickle, this at least is normal behaviour for most operating systems. The assuption is that the allocated memory will be needed again at some future point (here, the next time you do a save - which is valid). Also, once the working heap has been filled with objects, some of which subsequently get free’d it’s very complicated to work out which pages contain no allocted objects and can be returned to the OS pool so it’s almost never done.

If the heap size jumps significantly on the second save, then I’d be worried!

1 Like