MV IconCaptions causing CPU spikes and crash due to memory leak.

Hello!👋

I have run into some issues regarding the icon captions plugin.

When my mouse hovers over an icon for around 40-50 seconds, the game crashes (mostly when hovering over icon 1). The plugin is causing a massive cpu spikes, and that may lead to the possible memeory leak crash. (Checked with the console).

Ill attach the modified plugin, as well as its original version. It has been modified around line 127/182, to make it compatible with yanfly's core updates options, map window and core. I have no idea how to prevent the crash myself, so I ask for someone more knoweladeable to take a look on any possible solutions.😅

Thanks for any help in advance!
Code:
if (SceneManager._scene._skillWindow && SceneManager._scene._skillWindow.visible ||
        SceneManager._scene._itemWindow && SceneManager._scene._itemWindow.visible) {
        return;
    }

Always use () when chaining && and || together to make it more obvious how these conditions should be interpreted.
Oh, the issue lied here?😅
Thanks for the advice, and, if you could suggest how should I correct the code not to cause the memory leak? I want to be sure it works properly, thanks!
I don't know whether that would fix the memory issue - the plugin itself is not that easy to follow, I admit.

I suggest this line of code
Code:
if ((SceneManager._scene._skillWindow && SceneManager._scene._skillWindow.visible) || (SceneManager._scene._itemWindow && SceneManager._scene._itemWindow.visible)) {
I changed the code accoring to your reply, going from:
Code:
if (SceneManager._scene._skillWindow && SceneManager._scene._skillWindow.visible ||
        SceneManager._scene._itemWindow && SceneManager._scene._itemWindow.visible) {
        return;
    }
To:
Code:
if ((SceneManager._scene._skillWindow && SceneManager._scene._skillWindow.visible) || (SceneManager._scene._itemWindow && SceneManager._scene._itemWindow.visible)) {
        return;
    }
However, this did not fixed the issue, the game still shuts down after hovering over icon 1 for too long😢
Are you sure that even the original plugin (with your icon descriptions) does not break? Your modification doesn't look suspicious.
The original one (Asfgl_iconCaption) didn't worked with Yanfly's stuff, so I had to change it a bit, since the game wouldn't show any icon descriptions in original state, even after turning on the poper switch. Judging by the lack of reports I don't think the original had this issue? But im not 100% sure. My modified versions (IconCaptions) launches with the yanfly stuff, but has the memory leak issue. It doesn't seem to crash while hovering over icon 313, or maybe the memory just fills up slower, im not too savvy on those things.😢

The error I was getting was this:

TypeError: Cannot read property 'visible' of undefinedat Window_BattleStatus.updateCaptions (IconCaptions.js:127:41)at chrome-extension://odlameecjipmbmbejkplpemijjgpljce/js/plugins/IconCaptions.js:140:13at Array.forEach ()at Scene_Map.Scene_Base.updateChildren (IconCaptions.js:138:32)at Scene_Map.Scene_Base.update (YEP_X_CoreUpdatesOpt.js:8006:8)at Scene_Map.update (rpg_scenes.js:596:33)at Scene_Map.update (YEP_CoreEngine.js:1425:32)at Scene_Map.update (YEP_MapStatus Window.js:303:37)at Function.SceneManager.updateScene (rpg_managers.js:2024:25)at Function.SceneManager.updateMain [as updateMainFluidTimestep] (YEP_X_CoreUpdatesOpt.js:7951:12)


So it was my attempt at fixing it, witch seems to work, but has the memory leak issue😔
That's a needle in a haystack.

Try to disable all other plugins and then find out whether it's you modification or the combination of YEP&this plugin why it's not working.
Okay, as you suggested I did some testing, here are the results:
- Turned off all plugins exclept Icons: No crash
- Turned off only YEP plugins: crash happened

The crash seems to be caused by either one of HIME or SRD's plugins
- Turned off all SRD plugins: no crash

Seems one of the SRD's plugins is making the crash happen.
Upon further testing, the memory is happening when SRD_GameUpdate is active.

- Turned on everything YEP and other stuff without SRD_GameUpgrade: No crash

Seems I've found the culprit! If you can, could you look for why it may be causing such crahses together?
The conflict is likely caused by the functions starting from line 1030: Scene_Base

Try switching the order of the plugins. If you start SRD_GameUpgrade first and then the others, the error might not occur because the plugin causing the error could be overridden.
I've tried reversing the order, icons first then upgrades and vice versa, the issue presisted.😔

Original thread: https://forums.rpgmakerweb.com/threads/iconcaptions-causing-cpu-spikes-and-crash-due-to-memory-leak.181874/