Mystery: My savefile gets crazy big for not apparent reason.

0 favourites
  • 6 posts
From the Asset Store
7 Dark mystery music ranging from a piano arrangement to full orchestral pieces.
  • Hello all,

    I have a problem with the savefile of my game but I don't know what it is and where to start my investigation. Maybe one of you will have a suggestion?

    The problem:

    My game's savefile gets too big over time, and reach the browser's file size limit of 5 MB. The thing is: my savefile is normally only 20-50KB which is way under the 5000KB limit. But over time, the savefile gets bigger and bigger.

    I should specify that my game is an idle game (think Cookie Clicker), so it is meant to be left open for days and even month for some of my players. It is also saved and reloaded often hundreds of times. My players with the issue have had the game open for 1-2 months before the savefile reached above 5000KB.

    What I tried so far:

    1) I asked my player to send me his savefile, which I loaded in the game while running Construct's debugger. I can see in the debugger that everything seems normal. I don't see anything that would indicate a memory leak. I was expecting to see an object with billions of duplicates, but no. There isn't a layout with more than 100 objects in it.

    2) I added the behavior "don't save" to most objects that didn't required it (UI elements for example). That didn't help.

    3) I tried to create a new empty project where I create and destroy hundreds of objects every tick, and compared the savefile. I could NOT reproduce my issue this way (the savefile remained clean).

    The savefile

    He's the affected savefile:

    Looking at it, I can see which section is taking 99% of the space. It starts like this:

    It's followed by about 1500 pages of the same kind of data (yeah, just for fun I tried to print it to see how many pages I would get!) <img src="{SMILIES_PATH}/icon_e_smile.gif" alt=":)" title="Smile"> 
    As you can see, it starts with "[b]collmemory[/b]" which I tried to search on Google and Construct forums, but could not find anything about it. Do you know what that is? Do you know what is this giant list of numbers?
    Any hint would be welcome. Thanks!
  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • After more test, I found out that "collmemory" seems related with the "On collision with..." event. In a new empty project, I start to see "collmemory" in the savefile only when I add "On collision with" events. I assume that "collmemory" would mean "collision memory"?

    I could see how this could lead to my big savefile problem. In my game, lots of sprites are created, then destroyed when they collide with another object. I'm just wondering why data is saved in these cases.

    Any hint?

  • I was able to isolate the problem in a small capx file.


    This capx create a lots of orange sprites every ticks, and moves them inside a green box. On collision with the green box, the orange sprites are destroyed.

    That by itself isn't enough to reproduce the issue. You need to first save (using the debugger) and load that savefile (using the debugger). Only by loading the savefile will you start to experiment the issue.

    When you look at the javascript console, you can see the size of the savefile. It quickly gets very big, even if all the objects have been deleted.


    Steps to reproduce:

    1. Open the capx using Construct's debugger.

    2. Open the browser's javascript console.

    3. Save using the debugger. Notice the savefile's size in the console (about 1 KB).

    4. Activate the sprite creation by checking the checkbox.

    5. Leave it checked for about 5 seconds, then turn it off.

    6. Save again using the debugger. Notice that the issue didn't occurred (savefile is still about 1 KB).

    7. Click "Load" in the debugger to load that savefile. (that's the important step!)

    8. Activate the sprite creation again.

    9. Turn it off after about 5 seconds.

    10. Save using the debugger.

    11. Observe the issue : The savefile is now 100 times larger!

    So... what do I do with this? Is it a bug in Construct?

    What is it saving exactly that makes the savefile so large? Looking at what is inside "collmemory", it's just a few numbers for each sprite, but if they don't get removed when the sprites are deleted, then the savefile gets very huge over time. That's kind of a memory leak, right?

    Should I fill an official bug?

  • are you using the save&load plugin? if so do your objects have the nosave behavior on them?

    edit: looks like a bug

  • Confirmed, looks like a bug. Filed a report here:

    My best guess is since "on collision" is only triggered once per overlap that is somehow not being cleared, and when loading the id's of everything changes or something like that.

  • Thanks R0J0hound! Thanks volkiller730! I was really starting to worry here. Thanks!

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)