# Lambda Memory Usage

**URL:** <https://forum.serverless.com/t/lambda-memory-usage/11654>\
**Category:** Serverless Architectures\
**Tags:** aws, lambda\
**Created:** [June 2, 2020, 10:37pm UTC](https://forum.serverless.com/t/lambda-memory-usage/11654 "2020-06-02T22:37:20Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![justin-prather](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.serverless.com/justin-prather/32/4305_2.png) [@justin-prather](https://forum.serverless.com/u/justin-prather)\
**Post date:** [June 2, 2020, 10:37pm UTC](https://forum.serverless.com/t/lambda-memory-usage/11654/1 "2020-06-02T22:37:20Z")

</div>

Hi everyone.

I have been struggling to understand lambda memory usage. when i profile my functions locally, the max heap used is ~ 40mb. my (unzipped) bundle is ~35mb, so i would expect at most my function would use ~80mb. However, i consistently max out a 192mb container. Is there a way to simulate the memory limit of a function locally, or is there something obvious that i am missing when trying to figure out how much memory to allocate to my functions?

thanks in advance

---

<div class="post-metadata">

**Author:** ![BonniCase](https://avatars.discourse-cdn.com/v4/letter/b/ecb155/32.png) [@BonniCase](https://forum.serverless.com/u/BonniCase)\
**Post date:** [June 12, 2020, 4:53pm UTC](https://forum.serverless.com/t/lambda-memory-usage/11654/2 "2020-06-12T16:53:48Z")

</div>

Hi…I’m working with a Stan model, and I changed my calculation work process. I didn’t include any new information or boundaries, yet I replaced a straightforward calculation in boundary change with an increasingly intricate one. In this way caused Stan to begin utilizing a few times more memory; in certainty it presently would snatch all accessible memory and trade and freeze.

Is there a portrayal some place of how Stan utilizes memory, with the goal that I can make sense of what explicitly causes this?
