Skip to content

Huge increase in memory usage in v7 when building with Next.js + Pigment CSS #45804

Open
@Pikachews

Description

@Pikachews

Steps to reproduce

Steps:

  1. Clone the material-ui-pigment-css-nextjs-ts example
  2. npm install && rm -rd .next && npm run build --experimental-debug-memory-usage
  3. Observe peak memory usage of around 2 GB.
  4. Downgrade @mui/material to ^6
  5. npm install && rm -rd .next && npm run build --experimental-debug-memory-usage
  6. Observe peak memory usage of around 1 GB.

Current behavior

Memory usage has increased a lot (doubled) when upgrading to Material UI v7 and building the project, even on a barebones example project, consuming ~2 GB of memory.

Expected behavior

Memory usage during build time should not be significantly increased with the upgrade to Material UI v7.

Context

Trying to use Material UI + Next.js + Pigment CSS without having to increase Node.js --max-old-space-size in Github Actions. 🙁

Your environment

npx @mui/envinfo
$ npx @mui/envinfo

  System:
    OS: macOS 14.7.2
  Binaries:
    Node: 20.10.0 - ~/.nvm/versions/node/v20.10.0/bin/node
    npm: 10.2.3 - ~/.nvm/versions/node/v20.10.0/bin/npm
    pnpm: 8.14.0 - ~/Library/pnpm/pnpm
  Browsers:
    Chrome: 134.0.6998.166
    Edge: 134.0.3124.95
    Safari: 18.2
  npmPackages:
    @mui/material: latest => 7.0.1
    @mui/material-pigment-css: latest => 7.0.1
    @pigment-css/nextjs-plugin: latest => 0.0.30
    @pigment-css/react: latest => 0.0.30
    @types/react: latest => 19.1.0
    react: latest => 19.1.0
    react-dom: latest => 19.1.0
    typescript: latest => 5.8.2

Search keywords: pigment out of memory heap nextjs build

Metadata

Metadata

Assignees

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions