Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] heap out of memory in node 10.x when webpack's devtool configed cheap-module-source-map #77

Closed
beanlee opened this issue Nov 18, 2020 · 1 comment
Assignees

Comments

@beanlee
Copy link
Member

beanlee commented Nov 18, 2020

🐛 bug report

Describe the bug
devtool 编译生成 cheap-module-source-map 在 node 10 环境下内存溢出

[27849:0x102880000]   133250 ms: Mark-sweep 1377.8 (1409.0) -> 1377.8 (1409.5) MB, 366.7 / 0.0 ms  (average mu = 0.076, current mu = 0.015) allocation failure scavenge might not succeed


<--- JS stacktrace --->

==== JS stack trace =========================================

Security context: 0x1673f099e6c1 <JSObject>
    0: builtin exit frame: stringify(this=0x1673f09919f9 <Object map = 0x1673955842a9>,0x1673fa7826f1 <undefined>,0x1673fa7826f1 <undefined>,0x1673500ffcc9 <Object map = 0x167345daabb1>,0x1673f09919f9 <Object map = 0x1673955842a9>)

    1: arguments adaptor frame: 1->3
    2: /* anonymous */(aka /* anonymous */) [0x1673e6f2d6a1] [/Users/xxx/node_modules/webpack/lib/Sourc...

FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory

Environment (please complete the following information):

  • Node Version: v10
@beanlee beanlee self-assigned this Nov 18, 2020
@beanlee
Copy link
Member Author

beanlee commented Nov 18, 2020

.devtool(isDevelopmentEnv() ? "cheap-module-source-map" : "source-map")

在 node v10.22 版本下复现,切换到 node v12+ 以上问题消失。设置成其他可以映射源码的模式都会有内存溢出的问题 xxx-module-source-map

参考文档 https://webpack.docschina.org/configuration/devtool/

目前两种解决方案:

  1. 建议用户升级 node 版本;
  2. 修改 cheap-module-source-map 成其他非源码类的 map;(这种没法起到开发过程中查看映射源码 sourcemap 的作用,不可取
  3. 给 webpack devtool 提 issue 看能否让官方解决,分析下看具体是 node 10 问题,还是 webpack 实现时能否换一个实现方式的问题

@beanlee beanlee closed this as completed Jan 11, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant