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

npm start后访问Javascript内存超出限制访问不了 #47588

Closed
CooperHash opened this issue Feb 26, 2024 · 5 comments
Closed

npm start后访问Javascript内存超出限制访问不了 #47588

CooperHash opened this issue Feb 26, 2024 · 5 comments

Comments

@CooperHash
Copy link
Contributor

Reproduction link

https://github.com/ant-design/ant-design

Steps to reproduce

npm install
npm start

What is expected?

访问localhost:8001

What is actually happening?

<--- Last few GCs --->

[13623:0x138040000]   114777 ms: Mark-sweep (reduce) 1971.2 (2092.7) -> 1970.9 (2092.9) MB, 437.5 / 0.0 ms  (average mu = 0.162, current mu = 0.063) allocation failure; GC in old space requested


<--- JS stacktrace --->

FATAL ERROR: Reached heap limit Allocation failed - JavaScript heap out of memory
 1: 0x1005066e4 node::Abort() [/usr/local/bin/node]
 2: 0x1005068c8 node::ModifyCodeGenerationFromStrings(v8::Local<v8::Context>, v8::Local<v8::Value>, bool) [/usr/local/bin/node]
 3: 0x10065d60c v8::internal::V8::FatalProcessOutOfMemory(v8::internal::Isolate*, char const*, bool) [/usr/local/bin/node]
 4: 0x100807ec4 v8::internal::EmbedderStackStateScope::EmbedderStackStateScope(v8::internal::Heap*, v8::internal::EmbedderStackStateScope::Origin, cppgc::EmbedderStackState) [/usr/local/bin/node]
 5: 0x10080686c v8::internal::Heap::CollectGarbage(v8::internal::AllocationSpace, v8::internal::GarbageCollectionReason, v8::GCCallbackFlags) [/usr/local/bin/node]
 6: 0x1007fa900 v8::internal::HeapAllocator::AllocateRawWithLightRetrySlowPath(int, v8::internal::AllocationType, v8::internal::AllocationOrigin, v8::internal::AllocationAlignment) [/usr/local/bin/node]
 7: 0x1007fb144 v8::internal::HeapAllocator::AllocateRawWithRetryOrFailSlowPath(int, v8::internal::AllocationType, v8::internal::AllocationOrigin, v8::internal::AllocationAlignment) [/usr/local/bin/node]
 8: 0x1007e09a0 v8::internal::Factory::AllocateRaw(int, v8::internal::AllocationType, v8::internal::AllocationAlignment) [/usr/local/bin/node]
 9: 0x1007da614 v8::internal::MaybeHandle<v8::internal::SeqTwoByteString> v8::internal::FactoryBase<v8::internal::Factory>::NewRawStringWithMap<v8::internal::SeqTwoByteString>(int, v8::internal::Map, v8::internal::AllocationType) [/usr/local/bin/node]
10: 0x100aae184 v8::internal::String::SlowFlatten(v8::internal::Isolate*, v8::internal::Handle<v8::internal::ConsString>, v8::internal::AllocationType) [/usr/local/bin/n
Environment Info
antd 5.14.2
React 18.2.0
System mac m2
Browser chrome

难道是我的macbook内存不够的原因

@CooperHash
Copy link
Contributor Author

后续:在npm start后添加了NODE_OPTIONS='--max-old-space-size=4096' 即可运行

@MadCcc
Copy link
Member

MadCcc commented Feb 28, 2024

node 版本尽量拉到 18 以上,实在不行加上面的环境变量也可以。

@ammirator-administrator
Copy link

@MadCcc @CooperHash
Please reopen this is not fixed I have same erorr when trying to run tsc --noEmit --pretty --p . to lint the project types
Because of upgrade to version 5.17.4 of antd it happens, is not fixed in last version
this is a serious issue, a UI library should not eat this much memory like crazy
And please do not suggest to increase default memory usage a UI library should never eat 4GB that's insanity

@CooperHash
Copy link
Contributor Author

I don't know whether it's Umi's problem.

@ammirator-administrator
Copy link

Its a antd design error
see #49185 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants