Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

320
Views
Bull generate 2000 files Memory leak node.js

I currently have a problem generating two thousand pdf's using node.js and bull.

Indeed, I manage to generate about 400 pdf. Then I got this error message:

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

This is the bull queue and the function that generate the pdf files:

let myFirstQueue = new Bull(
      "firsttdssss",
      {
        redis: { port: 6379 },
      },
      {
        defaultJobOptions: { removeOnComplete: true, removeOnFail: true },
      }
    );

myFirstQueue.setMaxListeners(30);

for (let i = 0; i < 500; i++) {
  await myFirstQueue.add(data[i]);
}

let { generatePdf } = await import("~/lib/survey");

myFirstQueue.process(async job => {
  let filename = kebabCase(
    `${campaign.title} - ${job.data.employee.fullName.toLowerCase()} - ${moment().format("DD/MM/YYYY")} `
  );
  return generatePdf(campaign.template.body, job.data, filename, 210, 297);
});

myFirstQueue.on("progress", () => {
  console.log("progresds");
});

myFirstQueue.on("completed", () => {
  console.log("completed");
});

I have already tried to increase the node.js memory leak using :$env:NODE_OPTIONS="--max-old-space-size=8192"

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!