-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Closed
Copy link
Labels
p3-minor-bugAn edge case that only affects very specific usage (priority)An edge case that only affects very specific usage (priority)
Description
Describe the bug
We've noticed a high heap usage when running our tests.
After much debugging, we noticed that the following code looks for the configuration option for vmThreads even through we have explicitly defined vmForks as the pool to use
I believe it comes down to getWorkerMemoryLimit which has vmThreads hardcoded as the config to read.
https://github.com/vitest-dev/vitest/blob/main/packages/vitest/src/utils/memory-limit.ts#L22
export function getWorkerMemoryLimit(config: ResolvedConfig): string | number {
const memoryLimit = config.poolOptions?.vmThreads?.memoryLimit // <!-- This uses the `vmThreads` even though `pool: vmForks` is used
if (memoryLimit) {
return memoryLimit
}
return (
1
/ (config.poolOptions?.vmThreads?.maxThreads
?? getDefaultThreadsCount(config))
)
}The getWorkerMemoryLimit is called on this line:
https://github.com/vitest-dev/vitest/blob/main/packages/vitest/src/node/pools/vmForks.ts#L216
Thanks,
Reproduction
See above.
System Info
System:
OS: macOS 15.3.2
CPU: (12) arm64 Apple M4 Pro
Memory: 1.39 GB / 24.00 GB
Shell: 5.9 - /bin/zsh
Binaries:
Node: 22.15.0 - ~/.nvm/versions/node/v22.15.0/bin/node
Yarn: 1.22.22 - ~/.nvm/versions/node/v18.20.2/bin/yarn
npm: 10.9.2 - ~/.nvm/versions/node/v22.15.0/bin/npm
Browsers:
Chrome: 136.0.7103.93
Safari: 18.3.1Used Package Manager
yarn
Validations
- Follow our Code of Conduct
- Read the Contributing Guidelines.
- Read the docs.
- Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
- Check that this is a concrete bug. For Q&A open a GitHub Discussion or join our Discord Chat Server.
- The provided reproduction is a minimal reproducible example of the bug.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
p3-minor-bugAn edge case that only affects very specific usage (priority)An edge case that only affects very specific usage (priority)