Possible memory leak during lint stage of build
Answered
Large oak-apple gall posted this in #help-forum
Large oak-apple gallOP
I suspect there is memory leak. Or just huge memory consumption?
Originally build script took about 2gb memory during build.
After adding react query in one component it increased to well above 2.
I noticed it because build crashed with heap out of memory on 2gb ram (fixed by using max old memory flag).
And after I added react query in another place, it filled 2 ram + 3 swap almost entirely.
How can I test it on local machine reliably?
On windows
Tried this, but it is not working. Prints 40mb, so it seems it is not picking up child processes of build script
Originally build script took about 2gb memory during build.
After adding react query in one component it increased to well above 2.
I noticed it because build crashed with heap out of memory on 2gb ram (fixed by using max old memory flag).
And after I added react query in another place, it filled 2 ram + 3 swap almost entirely.
How can I test it on local machine reliably?
On windows
Tried this, but it is not working. Prints 40mb, so it seems it is not picking up child processes of build script
import { spawn } from 'node:child_process'
const child = spawn('npm', ['run', 'build'], {
stdio: 'inherit',
shell: true,
})
setInterval(() => {
const memoryUsage = process.memoryUsage()
console.log('\nMemory usage:', {
rss: `${Math.round(memoryUsage.rss / 1024 / 1024)} MB`,
heapTotal: `${Math.round(memoryUsage.heapTotal / 1024 / 1024)} MB`,
heapUsed: `${Math.round(memoryUsage.heapUsed / 1024 / 1024)} MB`,
})
}, 5000)
Answered by Large oak-apple gall
Solution or workaround
const nextConfig: NextConfig = {
typescript: {
ignoreBuildErrors: true,
},
}
"build": "tsc --noEmit && next build",
5 Replies
Large oak-apple gallOP
Maybe it is not react query, not sure.
Memory spike happens during
Just now on my computer it reached 3.7 gb during this step
ā Linting and checking validity of types
stepJust now on my computer it reached 3.7 gb during this step
Large oak-apple gallOP
Pretty sure it is not react query. Issue is this linting stage
Large oak-apple gallOP
Looks like it is typescript 5.8 causing this
Large oak-apple gallOP
Solution or workaround
const nextConfig: NextConfig = {
typescript: {
ignoreBuildErrors: true,
},
}
"build": "tsc --noEmit && next build",
Answer