Hi Omer,
Thanks for taking the time to respond.

I've already opened an issue in github perior to the discussion here.

https://github.com/nodejs/node/issues/57447#issuecomment-2738164130

LMK what you think

ב-יום חמישי, 20 במרץ 2025 בשעה 10:42:36 UTC+2, omer...@chromium.org כתב/ה:

> Hi Asaf,
>
> I don't think you need V8 to support this.
> Node could introduce a flag for it, compute the actual max old space size 
> in MB based on your percentage and the system memory, and pass that to V8 
> via the existing flag.
> That even sounds simpler to me.
>
> Omer
>
>
> On Thu, Mar 20, 2025 at 12:12 AM Asaf Federman <asaf1...@gmail.com> wrote:
>
>> Summary 
>>
>> Currently, --max-old-space-size requires a fixed memory value in MB. 
>> However, in containerized environments (e.g., Docker, Kubernetes), 
>> available memory can vary dynamically. Introducing a percentage-based 
>> option would allow Node.js to adjust its memory usage relative to total 
>> system memory, reducing the risk of OOMKills while optimizing performance.
>> Why is this needed? 
>>    
>>    - *Improves compatibility* with containerized environments where 
>>    memory limits are dynamic. 
>>    - *Prevents over-allocation & OOMKills* when memory limits change. 
>>    - *Simplifies memory management*, eliminating the need for external 
>>    scripts to compute heap size dynamically. 
>>
>> Proposed Solution 
>>
>> Introduce a new syntax for --max-old-space-size, allowing it to accept a 
>> percentage of total system memory, e.g.:
>> node --max-old-space-size=80% app.js 
>>
>> *Example Behavior:*
>>
>>    - On a system with *4GB RAM*, --max-old-space-size=80% would set it 
>>    to *3.2GB*. 
>>    - On a system with *1GB RAM*, it would set it to *800MB*. 
>>
>> Alternatives Considered 
>>    
>>    - Manually setting a fixed value, which requires prior knowledge of 
>>    system memory. 
>>    - Using external scripts (os.totalmem()) to calculate heap size 
>>    dynamically. 
>>
>> Request for Guidance 
>>
>> I’m new to contributing to V8 and would appreciate any guidance on the 
>> best way to approach this change. Specifically:
>>
>>    - Are there existing discussions or work related to this idea? 
>>    - Which parts of the V8 codebase should I explore for implementing 
>>    this? 
>>    - Any recommended best practices or similar features I should 
>>    reference? 
>>
>> Looking forward to your feedback and help! 🚀
>>
>> -- 
>> -- 
>> v8-dev mailing list
>> v8-...@googlegroups.com
>> http://groups.google.com/group/v8-dev
>> --- 
>> You received this message because you are subscribed to the Google Groups 
>> "v8-dev" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to v8-dev+un...@googlegroups.com.
>> To view this discussion visit 
>> https://groups.google.com/d/msgid/v8-dev/e44b0fcd-35a2-4d81-84df-a2fecdabd33en%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/v8-dev/e44b0fcd-35a2-4d81-84df-a2fecdabd33en%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>>
>

-- 
-- 
v8-dev mailing list
v8-dev@googlegroups.com
http://groups.google.com/group/v8-dev
--- 
You received this message because you are subscribed to the Google Groups 
"v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to v8-dev+unsubscr...@googlegroups.com.
To view this discussion visit 
https://groups.google.com/d/msgid/v8-dev/a8fb7122-b63d-4fdf-9e3f-f46ac9e69bcbn%40googlegroups.com.

Reply via email to