HUD Maker Ultra - Memory Leak

Hi all,

the main issue with the Plugin changed entirely, so please have a look at the second part of the post.

I've seen a few of you using the HUD Maker Ultra.
It has plugin commands to toggle the activeness and visibility of the HUD. I get the visibility thing but I don't get the purpose of the other one.

At first I thought that would be useful to avoid checking the parameters of the HUD every frame. Could be some performance improvement, since it won't check the conditions, when there's no HUD needed anyway.

But instead the HUD will appear semi-transparent, when turning it inactive. Means, it still checks the conditions to show the HUD.
Do you know the point of this? What would you need that for?

Thanks!


---

Hello,

I was investigating a major MemoryLeak in my game, hence the hunch, it would be good to deactivate HUD Maker Ultra when there's no HUD needed.

After stepping through the debug process with all plugins one by one, I found HUD Maker Ultra to be the culprit.
By stepping back and forth through maps, I can build up 3 GB RAM within minutes. I could push it higher till it crashes. W/o HUD Maker Ultra, I can barely hit 500MB.

My uneducated guess by observing the memory growth:
The Plugin creates on every scene change the entirety of HUD elements hidden, to be ready to appear on demand. Also, every element will listen to their conditions.
So, if I step back and forth through the maps, I will have dozens of Clones in no time.

Unfortunately, the plugin per se is amazing an vital for me, so I have to figure something out.

Could you guys help me brainstorming the best solution?
For now I see 3 possibilities:

1. The Plugin stores all their HUD elements in
\data\plugin\UltraHUD.json

My idea would be to create more of them, like UltraHUD1 and UltraHUD2.
By Variable or Plugin Command I could change the number of File to read for the plugin. That way I could tell them to check an empty Json as long as no HUD is needed.
Also I could split my HUD elements into tiny pieces by usage, instead of having all in one. Would load smaller HUDs when they are acutally needed.

What I don't know yet; the Json might not be read every Frame, but exported once by scene change. That way there would be nothing to read if I changed the HUD number, as the empty one was already loaded.


2. Make the "activate / deactivate" Plugin Command work. So actually stop everything instead of turning the HUD semi-transparent.
But same issue as no. 1, if the Plugin is deactivated during scene change, it might be past the loading point of the HUD.


3. Clean up all the junk data, when I leave a scene, to get rid of all the clones. Seems to be the best solution, but I think, the Plugin tries and fails with that already.


If you want to check the code, you can find it here:

I'm thankful for any thoughts on this.
What if you used the Switch/Variable conditions to turn elements on and off?

That plugin while amazing has some issues and SRD isn't supporting it anymore as per the Itch reviews.(His reasons are his reasons ofc, getting old sux)
What if you used the Switch/Variable conditions to turn elements on and off?
Every HUD element is properly grouped and has display Conditions assigned accordingly.
They are still lurking in the background, you can't get rid of them completely.
Well that sux. The plugin and the sister program made it just too easy to make fantastic Menu's/HUD's.

I hadn't noticed the issue in my projects, but my testing has been very limited tbh. Likely going to have to rethink a few things.
I have almost maxed out the limit of 500 HUD components, so it piles up quickly, if they start to multiply themselves. If you have less, it takes way longer to notice something. Also spamming map changes isn't quite the normal behaviour, but I can't ask the player to restart the game every 2 hours.

Would be great to solve this issue somehow to keep working with it.

While digging through the code, I seem to have found the answer to my initial question.
JavaScript:
    setGlobalVisibility(visible) {
        if(this.globalVisibility !== visible) {
            this.globalVisibility = visible;
            this.updateUltraHUDContainerVisibility();
        }
    }

    setGlobalActiveness(visible) {
        if(this.globalActiveness !== visible) {
            this.globalActiveness = visible;
            this.updateUltraHUDContainerVisibility();
        }
    }

    updateUltraHUDContainerVisibility() {
        const scene = SceneManager._scene;
        if(scene && scene.updateUltraHUDContainerVisibility) {
            scene.updateUltraHUDContainerVisibility();
        }
    }
To me it looks like both Commands do the same thing, so it's no surprise, the Active toggle turns the HUD invisible. But maybe there's more to it I don't see.

Edit:
Got the deactivation to work, but despite the HUD is in fact gone, it still will be loaded into cache every map change.

Original thread: https://forums.rpgmakerweb.com/threads/hud-maker-ultra-memory-leak.171799/