Skip to content

Configuring Memory for Vercel Functions

Learn how to set the memory of a Vercel Function.
Table of Contents
Choose a framework to optimize documentation to:

The memory configuration of a function determines how much memory the function can use while executing. This guide will walk you through configuring the memory for your Vercel Functions.

Functions using the Edge Runtime can't be configured with custom memory settings. This helps ensure minimal cold starts in their limited execution environment.

For other runtimes, you can configure the memory up to the allowed limits for your plan:

  1. Use the functions property within your vercel.json
  2. Use a glob pattern to specify the path
  3. Specify an integer defining the memory in MB for your Serverless Function (between 128 and 3008)
The order in which you specify file patterns is important. For more information, see Glob pattern.
vercel.json
{
  "functions": {
    "api/test.js": {
      "memory": 3008
    },
    "api/*.js": {
      "memory": 3008,
      "maxDuration": 30
    }
  }
}

To learn more about the maximum size of your function's memory, see Max memory size.

Last updated on December 1, 2023