Is there a way to set or emulate a max memory limit of a lambda function execution?
Most of us are probably developing on 8GB+ memory machines, but to be cost effective most probably run lambdas with low as possible memory on AWS. For some data/computation intensive apps it would be nice to develop with low memory restrictions offline.
For instance, can we limit the NodeJS process memory itself that serverless-offline uses?
Found this while I was looking for something else, but would V8's --max-old-space-size parameter help? Something like node --max-old-space-size=512 ./node_modules/bin/serverless offline. From what I read, Node will limit the memory. I can't find the exact number but I thought it was 1,5GB.
Thanks, I'll test it and report back. I noticed a couple NodeJS processes running so wasn't sure if it was spawning some child NodeJS process we couldn't tweak.
@petermorlion You are right, running it in that way does restrict the memory as desired.
@petermorlion If there is a cli option maybe an API method exist, so we could pass the max memory usage as a cli parameter and use it to hamper the handlers.