How do I debug Out of Memory Errors?

I’m seeing 540 - Out of Memory errors?

How do I profile my app to debug these errors?

If you see a 540 error, contact Layer0 support. We may need to allocate more memory to your serverless functions.