I noticed after testing my RMMZ game a bunch of times in a row that my CPU was at 100%, and that lots of instances of nwjs were open and taking up the majority of my memory. I had just been working in some Scripts that use arrays, so I was thinking that might have to do with it, so I figured I'd ask here.
Are there efficient ways to search for if something is causing a memory leak? I've looked on the Memory tab of the debug log, but I'm not sure how to efficiently read the data. I've seen the number raising to ~150-190 kB/s and in red, so I'm not sure if that is bad and might be causing this. So any insight on this would be helpful!
In addition, since I haven't used arrays a whole lot in my JavaScript experience, I wanted to see if anyone could spot anything wrong with my code that could be causing it to use up a lot of memory, or if there's a way to do this more efficiently that doesn't use as much memory.
Here's one of the arrays I have:
And then this one has a bit more code:
I also have a few Conditional Branches that check for things like this:
There are some more instances of this type of code throughout, but this is the main code that I added that I thought might be a contributor.
Are there efficient ways to search for if something is causing a memory leak? I've looked on the Memory tab of the debug log, but I'm not sure how to efficiently read the data. I've seen the number raising to ~150-190 kB/s and in red, so I'm not sure if that is bad and might be causing this. So any insight on this would be helpful!
In addition, since I haven't used arrays a whole lot in my JavaScript experience, I wanted to see if anyone could spot anything wrong with my code that could be causing it to use up a lot of memory, or if there's a way to do this more efficiently that doesn't use as much memory.
Here's one of the arrays I have:
JavaScript:
let activeMission = $gameVariables.value(159);
activeMission.push("EscapeFromThePartyPlace"); // 1
activeMission.push("Channel6Acting"); // 2
activeMission.push("OutlawBarParty"); // 3
And then this one has a bit more code:
JavaScript:
let activeMission = $gameVariables.value(159);
let eventure = $gameVariables.value(117);
let failedMission = $gameVariables.value(161);
var index;
var removed;
if (activeMission.includes("EscapeFromThePartyPlace") && eventure != "Party Sanctuary") {
failedMission.push("EscapeFromThePartyPlace");
index = activeMission.indexOf("EscapeFromThePartyPlace");
removed = activeMission.splice(index, 1);
}
I also have a few Conditional Branches that check for things like this:
JavaScript:
$gameVariables.value(159)[1] != undefined;
There are some more instances of this type of code throughout, but this is the main code that I added that I thought might be a contributor.
