Ravenknight said: Scott C. said: Can also just Jason.stringify it and use .length on the string to get a decent approximation. ...that statement went way over my head. :) I love them scripts but I will never understand how they work. Well, first of all, my phone apparently doesn't recognize code speak, so Jason, should have been JSON. Now, that I'm on my computer, you could do something like this to get a rough estimate of the state's size: on('ready',()=>{
log('-=> The state is roughly ' + JSON.stringify(state).length/1000000 + 'mb');
//Could probably even iterate through each property of the state to get a log of how much space each script is taking up by adding the following:
var scripts = _.keys(state);
_.each(scripts,(s)=>{
log(' >> Script '+s+' is using roughly '+JSON.stringify(state[s]).length/1000000+' mb);
});
}); Turning the object(s) into a string and taking the length works because each character is equal to one byte. The above is untested, but I think it should work, Scott