You're using the awesome JSDOM package to process a few hundred html files and your process crashes with an error like this:
FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - JavaScript heap out of memory
If you're sure your code it not accidentally holding on to a reference to (nodes from) prior window objects, then the most likely cause of the apparent memory leak is that