most developers don't know basicHTML even exists ... here a trace that shows 8 times less memory usage for your server-side related projects.
JSDOM goal is to reflect standards 100%, making it heavy and slow, which is great for headless tests, but pointless in most other cases π
AFAIK, you don't have direct control over freeing the memory in Node.js, you may only allow for it be freed by the garbage collector.
The issue isn't really tied to your code anyway, see the impact of just switching to a lighter HTML/DOM implementation than JSDOM