On electron 7 drawing on hidden canvas will trigger a memory leak. Not appending the canvas for the DOM seems to solve the problem.