-
-
Notifications
You must be signed in to change notification settings - Fork 258
Description
Hi,
Thank you for creating and maintaining this great library!
I’m using Pica to resize images uploaded by users in my application. Currently, I’m creating a new instance of Pica for every uploaded image, as shown below:
img.onload = async () => {
let picaInstance = pica();
try {
const blob = await picaInstance.resize(img, canvas, { quality: 3 });
// Additional processing...
} catch (error) {
console.error(error);
}
};
Recently, we noticed a memory spike in our application during high-frequency uploads. I suspect it might be related to creating a new Pica instance for each upload.
My questions are:
-
Could creating multiple Pica instances cause memory issues or inefficiencies in this scenario?
-
Would it be better to move the Pica instance outside the function and reuse it globally?
For context:
-
The application handles multiple concurrent uploads.
-
Performance and memory optimization are priorities.
I’d appreciate any guidance or recommendations for best practices when using Pica in this way.
Thank you for your help!