Max Call Stack

I have been getting this error non stop, and i cannot figure out why every time i think i figured it out it keeps coming back, the weird thing is it only happens on certain
Capture.PNG
maps but i cannot find anything off about the maps.
This happens when JSON objects are too deeply nested within one another (which is veery unlikely in this case, as the depth limit is usually very high) or have circular dependencies (i.e. A contains B and B contains A). It's most likely an issue with some plugin on your project.

From the stack trace I'd say it's possibly an issue with Visustella's, but the root cause might be somewhere else entirely (altough I think it's weird that they call JsonEx from Game_Battler#equipSlots, seems kinda odd to me).

Have you added any plugins to your project recently that could have an effect on the equipment slots?
Max Call Stack is mostly a function that is called contantly in a loop without
stopping it, like parallel proces, but you can screenshot the event or map where
it happens to figure out the root of the problem.
Max Call Stack is mostly a function that is called contantly in a loop without
stopping it, like parallel proces

Just to clarify, that's not true. A (regular) loop does not consume the call stack, and parallel process certaninly does not too.

A stack is a data structure that follows LIFO order, and it's useful in many ways. Particularly, there's something called the call stack (or simply "the stack") in programming which is basically the mechanism that handles function calls. If you ever wondered how the computer knows how to come back to where it came from when a function returns, now you know: it's simply a matter of adding a new frame to the stack whenever the function is called and then "popping" it once it's done.

The thing about the stack though is that it doesn't increase in size unless you call a function from within another one, because once your function is done running its frame will be dropped and you'll end up with a stack the same size as you had before calling it.

For example, you could run this code ad infinitum, no problems:

JavaScript:
function f() {
    // Here the stack has depth 1, because we added the context for
    // this function on top of it...
    console.log("This is a function!");

    // ... but as soon as this returns, it will be dropped!
}

for (;;) { // for-ever
    // Here the stack has depth 0
    f();
    // Here the stack has depth 0 again!
}

Since the stack has at most a depth of 1 (i.e. a single nested function call), we wouldn't have any problems with it running on a loop.

However, this code will give you trouble:
JavaScript:
function recursive(depth) {
  console.log("This is recursive! Depth is", depth);
  recursive(depth + 1);
}

recursive(1);

As you can see, this function is recursive. Whenever a call to a function happens, the stack size increases, and since the function calls itself before returning, it will never drop the previous frames. This will cause a stack overflow, and JS will tell us we exceeded the maximum call stack size.

This is exactly what happens with JSON.stringify. Since JSON is recursive by definition, stringify will make recursive calls to serialize properties of an object. If there are too many nested objects, then it'll keep calling itself until the stack is depleted. Similarly, self-references can cause the same effect and make it recurse indefinitely.
Could it be a plugin I am using that is causing this or will it be a variable or event that I have running?
It's definitely an issue with some plugin, probably something that is incompatible with Visustella's Item Equip core. It could be an event triggering it (thus it only happening in some maps) but the cause is not event-related.

Original thread: https://forums.rpgmakerweb.com/threads/max-call-stack.128253/