NodeJs caps memory usage on r6i.xlarge instance (32GB RAM) at 16GB

0

Hello. We are running our NodeJs application which creates considerable memory pressure. We acquired a large server, however, NodeJs caps memory usage at 16GB regardless of settings (--max-old-space-size=30000). We tried different instances, with docker (AWS Linux) or without (Ubuntu 22), but the cap stays the same. It is a 64-bit version of Node (otherwise, it would have capped at ~4GB). We've tried Node versions 18.15, 18.19, 20.11. Interestingly, locally on a dev-machine (MacOS, 16GB RAM) it manages to occupy 18GB+ (although it takes nearly forever because of swapping) and doesn't crash. The error we are observing on AWS server is

terminate called after throwing an instance of 'std::bad_alloc'
  what():  std::bad_alloc

Any hint is appreciated that would point to a new direction in this investigation

Grety
質問済み 4ヶ月前288ビュー
1回答
0

Inspect your Node.js application for memory leaks. Even if you increase the memory limit, a memory leak can eventually lead to crashes and use memory profiling tools to understand how your application is using memory and identify potential areas for optimization.

profile picture
Jagan
回答済み 3ヶ月前
  • Thank you for looking into this. I've created a test script that recreates the problem. There are no leaks (unless in V8). I intentionally use more than 16GB of memory inside the test script. It runs fine on a local machine under MacOS and fails on AWS as soon as 16GB is reached

ログインしていません。 ログイン 回答を投稿する。

優れた回答とは、質問に明確に答え、建設的なフィードバックを提供し、質問者の専門分野におけるスキルの向上を促すものです。

質問に答えるためのガイドライン

関連するコンテンツ