Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

In V 0.16, an out of memory error occurs when a Japanese font is specified. #1584

Open
sunvisor opened this issue Jan 11, 2025 · 0 comments
Open

Comments

@sunvisor
Copy link

sunvisor commented Jan 11, 2025

Bug Report

Description of the problem

In V 0.16, an out of memory error occurs when a Japanese font is specified.
The following sample script outputs pdf correctly in V0.15, but an out of memory error occurs in V0.16.

Code sample

PDFDocument = require('pdfkit');
fs = require('fs');

//Create a document
doc = new PDFDocument();
doc.pipe(fs.createWriteStream('sample.pdf'));


doc.font('./fonts/NotoSansJP-Regular.ttf') // set your favorite font
  .fontSize(30)
  .text('これはSample PDFファイルです', 50, 10)
  .end();

Error message (Only the beginning part)

<--- Last few GCs --->

[17565:0x128008000]    48595 ms: Scavenge (interleaved) 4089.5 (4099.1) -> 4088.0 (4103.6) MB, pooled: 0 MB, 9.42 / 0.00 ms  (average mu = 0.265, current mu = 0.255) allocation failure;
[17565:0x128008000]    49581 ms: Mark-Compact (reduce) 4088.2 (4103.6) -> 4087.9 (4096.6) MB, pooled: 0 MB, 838.33 / 0.00 ms  (+ 0.8 ms in 0 steps since start of marking, biggest step 0.0 ms, walltime since start of marking 842 ms) (average mu = 0.233, cu

<--- JS stacktrace --->

FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory
----- Native stack trace -----

Your environment

  • pdfkit version: 0.16
  • Node version: v23.4.0
  • Operating System: macOS 14.6.1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant