Doesn't break hotpatching anything related to battles this time!
ProcessWrapper was holding on to references to ProcessManager after its
process had been killed and it had been removed from ProcessManager's
list of processes, keeping it on the heap. Not good. This removes all
references to the wrapper's manager when disconnecting its process,
allowing it to be GCed.
- spawning and setting up child processes is now handled by
ProcessManager#constructor rather than needing to be done manually for
each module that uses ProcessManager
- direct references to ProcessManager in ProcessWrapper were removed to
prevent dead ProcessWrapper instances from being leaked when hotpatching
- process-manager.js and verifier.js now use Typescript
Replacing direct references to the arguments object of functions with rest
parametres prevents the function from being deoptimized while still allowing
use of arbitrary arguments. This may also fix some minor memory leaks related
to mishandling the arguments object.
Before, an options object containing properties and values to be used
was how decorated instances of the class would be created. This meant
the constructor could assign anything you feel like to `this`. Rather
than that, the constructor now assigns a strict set of values, and
methods are redefined in subclasses.
Basic unit tests were added to test if they could be written for after
the final refactor to fix the other memory leak here.
This method would leak its arguments object before. The changes here saved
~30KB of memory from being leaked when running /itemsearch atk, for example.