Memory Leak

Hello everyone!,


Since this had been adressed several times already, I thought that this would have been fixed:

If I open the menu scene in the game and close it again for a few times in a row, more and more memory will be used, eventually crashing the whole game (with my 4GB RAM Computer this only takes approximately 20 times of reopening the menu).

Is there a way to prevent this from happening? I'm using the "newest" 1.5.2 version of the maker. This problem is a huge setback for me, because if the game crashes after the player opens a menu for fifteen times, I would be forced to leave my project and hope for a bug fix...


Thanks in advance!
No. That is not fixable as it would require some major changes which would slow down the engine drastically. It was decided to leave that alone (for now) as no sane person would realistically open the menu that many times in a row in the 1 - 2 minutes it takes for the garbage collection function to clean up the memory.

But...if you are getting it over a long period of time in a clean project, report it to the dev team and send them your project. But it has to be a clean team, as they take no responsibility for poorly coded plug-ins which cause a memory leak. That you will have to take up with the plug-in writers.
As far as i can tell (since i'm not programmer) this issue is caused by the blur effect applied in the scene.
When i disabled it using YEP CORE ENGINE i had no memory leak issues afterwards.
No. That is not fixable as it would require some major changes which would slow down the engine drastically. It was decided to leave that alone (for now) as no sane person would realistically open the menu that many times in a row in the 1 - 2 minutes it takes for the garbage collection function to clean up the memory.

But...if you are getting it over a long period of time in a clean project, report it to the dev team and send them your project. But it has to be a clean team, as they take no responsibility for poorly coded plug-ins which cause a memory leak. That you will have to take up with the plug-in writers.



Thanks for the help, but even after five minutes waiting the amount of memory used is not dropping by any amount. How can i determine, how long the garbage collection needs to actually do something? Or have I missunderstood the GC-function?
(There are not plugins involved, since this appears in a clean new project.)

Btw, this problem also appears when changing maps multiple times.




As far as i can tell (since i'm not programmer) this issue is caused by the blur effect applied in the scene.
When i disabled it using YEP CORE ENGINE i had no memory leak issues afterwards.



I don't really know what you are talking about, do you mean the opacity of the windows or the text padding?
Thanks for the help, but even after five minutes waiting the amount of memory used is not dropping by any amount. How can i determine, how long the garbage collection needs to actually do something?
what is your projects core version?
You said that you're using the 1.5.2 of the maker, but that does not automatically mean that your project is also 1.5.2 - you could open a 1.0 project with an 1.5.2 editor, and then the project would still contain the old core with its many memory leaks.

go to your project folder, search for the file named rpg_core.js and open it with a text editor (do not doubleclick it), then read the version number at the end of the title line. no number means 1.0.
I don't really know what you are talking about, do you mean the opacity of the windows or the text padding?

At least on default, when you open the menu, it shows the current game screen as background, but blurred. That is, the menu windows look like they are transparent frosted glass that shows the game "through" them. Kovak suggested that disabling this blurring effect with Yanfly's Core engine should take the brunt out of the memory leak.
what is your projects core version?
You said that you're using the 1.5.2 of the maker, but that does not automatically mean that your project is also 1.5.2 - you could open a 1.0 project with an 1.5.2 editor, and then the project would still contain the old core with its many memory leaks.

go to your project folder, search for the file named rpg_core.js and open it with a text editor (do not doubleclick it), then read the version number at the end of the title line. no number means 1.0.


Hm, my current project is at version 1.6 (rpg_core.js). Could that be causing problems?



At least on default, when you open the menu, it shows the current game screen as background, but blurred. That is, the menu windows look like they are transparent frosted glass that shows the game "through" them. Kovak suggested that disabling this blurring effect with Yanfly's Core engine should take the brunt out of the memory leak.


Ah, thank you, I will try if that works! But I guess this wouldn't be a solution for the buildup of memory usage when changing maps?
Hm, my current project is at version 1.6 (rpg_core.js). Could that be causing problems?
yes, especially if you've gone back to 1.5.2 with the editor.
the 1.6.0 made some changes that broke a lot of plugins, so I would make a copy of your project as backup and then revert it to 1.5.2 for the time being. Might or might not solve this specific problem, but would help preventing possible other problems with plugins.

Second, keep in mind that memory leaks are additive and often caused by plugins as well. We haven't seen much problems about this specific memory leak since the core was fixed with version 1.4 or so. But if you have a plugin linked to the menu function that has its own memory leak, then that plugin would cause the same effect.
Can you give a screenshot of your plugin manager with all plugins listed? that way we can check for that possibility as well.
At least on default, when you open the menu, it shows the current game screen as background, but blurred. That is, the menu windows look like they are transparent frosted glass that shows the game "through" them. Kovak suggested that disabling this blurring effect with Yanfly's Core engine should take the brunt out of the memory leak.
yes, especially if you've gone back to 1.5.2 with the editor.
the 1.6.0 made some changes that broke a lot of plugins, so I would make a copy of your project as backup and then revert it to 1.5.2 for the time being. Might or might not solve this specific problem, but would help preventing possible other problems with plugins.

Second, keep in mind that memory leaks are additive and often caused by plugins as well. We haven't seen much problems about this specific memory leak since the core was fixed with version 1.4 or so. But if you have a plugin linked to the menu function that has its own memory leak, then that plugin would cause the same effect.
Can you give a screenshot of your plugin manager with all plugins listed? that way we can check for that possibility as well.


I just tested this with a 1.5.2 project (.js files changed to the 1.5.2 versions). The problem is still there, even without any plugins or modifications.
I just tried to reproduce your problem.
I opened my project, and started mashing the Esc button to toggle the menu on and off.

My memory consumption is fairly stable between 190 and 220 MB, despite opening and closing the menu over 5 times per seconds during 1-2 minutes.

Disclaimer:
I am running 1.6.0 and my menu is customized in that I only have "Items", "Options", "Save", and "Exit". I also made the menu windows transparent.

It's possible that this particular memory leak has already been fixed in 1.6.0.
In case you're wondering: 1.5.2 was released due to critical issues with 1.6.0. You'll either have to wait for 1.6.1 or avoid moving maps around in the editor, and avoid selecting B-E tiles as event sprites.


EDIT:
I just wrote a small plugin that should force the Garbage Collector to do its work when you close the menu. Maybe this'll help in your case?

Code:
(function() {
 var Scene_Menu_createCommandWindow = Scene_Menu.prototype.createCommandWindow;
 Scene_Menu.prototype.createCommandWindow = function() {
  Scene_Menu_createCommandWindow.call(this);
  this._commandWindow.setHandler('cancel', ExitMenu.bind(this));
 };
 var ExitMenu = function() {
  this.popScene();
  gc();
 }
})();
I just tried to reproduce your problem.
I opened my project, and started mashing the Esc button to toggle the menu on and off.

My memory consumption is fairly stable between 190 and 220 MB, despite opening and closing the menu over 5 times per seconds during 1-2 minutes.

Disclaimer:
I am running 1.6.0 and my menu is customized in that I only have "Items", "Options", "Save", and "Exit". I also made the menu windows transparent.

It's possible that this particular memory leak has already been fixed in 1.6.0.
In case you're wondering: 1.5.2 was released due to critical issues with 1.6.0. You'll either have to wait for 1.6.1 or avoid moving maps around in the editor, and avoid selecting B-E tiles as event sprites.


EDIT:
I just wrote a small plugin that should force the Garbage Collector to do its work when you close the menu. Maybe this'll help in your case?

Code:
(function() {
 var Scene_Menu_createCommandWindow = Scene_Menu.prototype.createCommandWindow;
 Scene_Menu.prototype.createCommandWindow = function() {
  Scene_Menu_createCommandWindow.call(this);
  this._commandWindow.setHandler('cancel', ExitMenu.bind(this));
 };
 var ExitMenu = function() {
  this.popScene();
  gc();
 }
})();


Thanks, but sadly this doesn't seem to work for me.
Could that possibly mean that the problem is more in your setup's inability to handle garbage collecting, regardless who was using javascript?
thanks guys. i had the same problem, checked the plugins one by one. yanfly's and other dont make me memory leak.
but Sumrndmde window upgrade make me a very big memory leak until the game crashes. its a very nice plugin, but dont work for me 🙁
Necro-post notice: @Zelta1
Moderator note: Also this is a completely different case you are discussing here. Either ask on a thread for that plugin, or create a thread on your own, giving us a link to that plugin and asking for help with your issue. Don't hijack other threads pleases. Closing this

Original thread: https://forums.rpgmakerweb.com/threads/memory-leak.93951/