Closed budchirp closed 1 year ago
How about the production environment?
Hi @Nefcanto, can you open a new issue with a repro of your setup/what operations you noticed increased memory usage?
Watching this carefully, as I have a Next project with about 12 pages and 260 static pages. 547MB free mem, and it dies rather quickly
The Production build seems to run fine for me, really quick.
The fixes @feedthejim suggested, regarding changing the Memory Limit, and also the patches introduced have stopped the server from crashing in Development mode.
I think the only serious problem for me, seems to be how slow the App is in Development mode - when trying to navigate between pages, I can sometimes wait for up to 8-10 seconds for each page to switch - Whilst in production it's almost instantaneous.
I'm unsure the cause, just hinders productivity quite dramatically.
The Production build seems to run fine for me, really quick.
The fixes @feedthejim suggested, regarding changing the Memory Limit, and also the patches introduced have stopped the server from crashing in Development mode.
I think the only serious problem for me, seems to be how slow the App is in Development mode - when trying to navigate between pages, I can sometimes wait for up to 8-10 seconds for each page to switch - Whilst in production it's almost instantaneous.
I'm unsure the cause, just hinders productivity quite dramatically.
Do you fetch data in layout ? I just found out that fetching in layout reduce a lot development mode.
@adshodgson do you mind sharing a repro (preferably via codesanbox or similar tool)? I can take a look.
There's a few things that can slow down dev times:
react-icons
where it bundles a huge amount of files, this might affect you. I'm investigating ways we can make that better.
async function Layout() { const somethingThatDoesntNeedToBlockRendering = await something();
return <>
{somethingThatDoesntNeedToBlockRendering &&
// better alternative that leverages streaming
function SomethingThatDoesntNeedToBlockRendering() {
return somethingThatDoesntNeedToBlockRendering &&
function Layout() { return <>
@feedthejim I sent you an invitation here. This is one of our real-world examples. We are a website design company. We use Next.js as our website tech and other technologies for our backend and API. We're still using Next.js 12. We used ASP.NET Core Razor Pages before and we had much more density per server. We could host 10 websites per 1GB of RAM. Now we're limited to 1 or 2 at most. This has increased our hosting costs drastically and we're thinking of migrating to another tech, like Qwik maybe.
But if we can get lower RAM in production, then we're good to continue using Next.js.
@feedthejim, I would gladly send you remote access to my PC and I would continue the debugging session with you if you want to. I would guide you through our architecture (though it's not hard at all), and explain how we use Next.js. Just let me know. Thank you so much.
I'm also encountering this and can share a repo.
in case it helps im on a Macbook Air M1, 2020, 16GB, Ventura
this is from running npm run dev
only
"next": "^13.0.8-canary.0",
One thing that i find really strange is how slow my app takes to compile when switching pages during development mode,
- this is exactly what i notice as well
Hi all!
I do not know if this helpful, but this happens also when testing with next/jest
when you I run jest --watch
.
Any official fix yet? still happening for me and export NODE_OPTIONS=--max_old_space_size=8192
won't help at all. I'm running next 13.0.3-canary.0
@logann131 can you try upgrading and report back if it still happens?
Also facing this issue, memory climbs to ~5GB while it should be ~30MB. Trying to remove all code until it's fixed to find the cause.
@mooijtech on a dev or prod instance?
@feedthejim Long story short, turns out the memory leak is not related to NextJS but Tauri (https://tauri.app/) caused by the tauri-plugin-persisted-scope
.
I will open an issue there.
Thanks for your reply.
I notice using dynamic
to render component seems to provide some improvement mostly if the SSR is set to true, just in case anyone here want to experiment on that too.
I am having this error, sometimes, can someone explain this?
@dexter4life can you perhaps open an issue with a repo?
I'll be closing this issue as the frequency of the reports seems to have lessened a bit. Please open an issue with repro steps if you encounter issues again!
This closed issue has been automatically locked because it had no new activity for a month. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you.
Verify canary release
Provide environment information
What browser are you using? (if relevant)
Chrome Canary v109.0.5400.0 (Android)
How are you deploying your application? (if relevant)
Vercel
Describe the Bug
The memory usage on the last next 13 (13.0.3-canary.0 and 13.0.2) releases are too high.
next dev
command uses about 1gb of ram. Next 12 is using about 300mb-500mb's of ram.Expected Behavior
next dev
should use less ram.Link to reproduction
.
To Reproduce
next dev