porta
porta copied to clipboard
prawn memory leak workaround
We can't easily upgrade prawn because of API changes that will require reimplementing of PDF generation code.
Issue was fixed upstream with prawnpdf/prawn#430 and described as:
It boils down to
text.rb#L147making use of a thread-local cache for character sizes of the current font. The Font objects don't implement #hash or #eql?, so different instances of the same font will end up creating different keys in the thread-local and thus growing the cache.
In our workaround, we just clear that cache after each PDF creation as that can be done externally without forking prawn. At some point we need to take the time and update to the latest prawn version.
fixes THREESCALE-8120