Engine's memory usage and saving issue

I want to ask here first before I report anything as a bug.

I usually keep a project open for days because I don’t really like waiting for it to reload. However, I’ve seen an issue from doing this. Upon a project first being loaded, the engine uses ~1GB of memory. Over time, it built its way all the way up to ~4GB.

This is also where I started seeing issues with saving. There was a script I had and made changes to, right? The Defold editor would say that all these changes were saved and all. However, upon creating a bundle, I find that an older version of the script was compiled. I close and reopen the editor to see the script back to a previous state. Even upon checking the github repository for the project, the file is in that previous state, meaning the engine never flushed the changes to disk. I would assume this is due to the increase of memory usage as the time went on. Is there anything that could explain this behavior?

Hi!

Regarding the memory usage, It’s hard to say for sure if there may be an issue or not. But it can be normal, especially if the editor is left running for a while.

The editor using more memory over time may be due to the Java Virtual Machine acclimatizing to your editing situation. The JVM memory heap size will typically grow over time as it finds a “comfortable” working set in order to run as efficiently as possible. In reality, a lot of that memory will be paged in and out as it is needed by the operating system. It does not mean that the editor is exclusively claiming 4GB of resident RAM.

Regarding the unsaved files, could it be that the files you edited were part of a library such as builtins or another project dependency? These files can be edited in memory in order to do minor experiments, but changes to these files will not be saved, because the resource you’re editing is an entry within a .zip file, and not an actual file on disk.

4 Likes

Regarding the unsaved files, could it be that the files you edited were part of a library such as builtins or another project dependency?

Nope. It was a script file created by me. When you edit a file inside an extension/builtins, Defold doesn’t say its saved. It keeps the asterisk * that shows that it’s not saved. This is a completely different case where a script I created is not flushed to disk despite the editor saying that it was. The debug couldn’t even detect this. The only time I’ve ever noticed it is whenever I wanted to make a bundle, where I learn that it is trying to compile a previous version of the file and did not actually save any of the previous data.