foliojs/pdfkit

Please use lru to cache font layout to fix memory leak

abihf opened this issue · 1 comments

Bug Report

Description of the problem

There's memory leaks when using custom fonts with huge data. I can disable fontLayoutCache but the performance is 3x slower.

I think we should use lru instead of simple object here

Code sample

//TODO:

Your environment

  • pdfkit version: 0.15.0
  • Node version: 20.14.0
  • Browser version (if applicable): -
  • Operating System: Mac and Linux

Can you provide a PR?