How `maxHeapMemory` is calculated

TypeScript SDK has this maxCachedWorkflows config that mentions a formula based on max. heap memory.

We want to use a different config, as we suspect 600WF per GB might be too much in our case.

How’s this max. heap memory calculated? Just so we can use the same formula, but with a different value.

How’s this max. heap memory calculated?

it comes from V8 heap statistics info - V8 | Node.js v23.8.0 Documentation
see code here.

an user also wrote blog here that think is pretty good if that helps