-
-
Notifications
You must be signed in to change notification settings - Fork 76
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
RSS memory adjustment #525
Comments
I don't think the high usage of RSS memory is a memory leak 🤔 |
I'm sorry; by the way: |
relevant: |
Sorry to interrupt again; I solved it by exposing the Here is my code In multi-child process mode, there will be memory contention and trigger OOM 2 child process; 400 tasks ; image ~2M webp Even at the end of the task, the memory usage is not less than 50% Looking forward to your reply |
@rambo-panda how did you solve it by exposing the global.gc? I call gc often but RSS grows to a point I get an out of memory error eventually... I've tried:
Any thoughts would be appreciated! |
@CypherHub the essence of the problem is just as @Brooooooklyn changed the name of the title;
taken together, this gives us the illusion of a Here is my code(hope it is useful for you); my task queue has no strict time requirements const getCanvas = (() => {
const getRss = isFunction(process.memoryUsage.rss)
? process.memoryUsage.rss
: () => process.memoryUsage().rss,
GC_LIMIT = 1024 * 1024 * 820, // 820M we will start 8 child_process -- 8G memory
$gc = async () => {
if (getRss() > GC_LIMIT) {
global.gc?.({ type: "major", execution: "async" }); // Return an promise
await sleep(10e3);
}
};
setInterval($gc, 15e3).unref();
return async (width, height) => {
await $gc();
const c = createCanvas(width, height);
c.getContext("2d");
return c;
};
})();
const renderStrokesImage = async ([w, h]) => {
const canvas = await getCanvas(w, h),
{ctx } = canvas;
....
} |
it has been maintained at
1453.232128mb
The text was updated successfully, but these errors were encountered: