Fix OOM when parsing skins

This commit is contained in:
Jordan Eldredge 2019-09-23 08:33:23 -07:00
parent d4a16239ed
commit 7f25ab2fb9
2 changed files with 595 additions and 521 deletions

File diff suppressed because it is too large Load diff

View file

@ -8,6 +8,7 @@ const { getClass, getFunctionObject, getFormattedId } = require("../objects");
const glob = require("glob");
const CALL_OPCODES = new Set([24, 112]);
const SKIN_FILENAME_BLACKLIST = new Set(["Fuzzy_Muffins.wal"]);
function findWals(parentDir) {
return new Promise((resolve, reject) => {
@ -79,8 +80,13 @@ async function main(parentDir) {
// all skins into memory, which leads to us running out or memory, we
// purposefully run them syncronously. If we find this is too slow we could do
// something like https://www.npmjs.com/package/p-limit
for (const walPath of paths.slice(0, 500)) {
for (const walPath of paths) {
try {
const fileName = path.basename(walPath);
if (SKIN_FILENAME_BLACKLIST.has(fileName)) {
continue;
}
console.error(`Working on ${walPath}`);
callCounts.push(await getCallCountsFromWal(walPath));
} catch (e) {
const errorLine = e.toString().split("\n")[0];