Open OutOfEastGate opened 1 day ago
Please try NODE_FLAGS
.
Can Node_LLAGS take effect in V8 mode? It doesn't take effect after I set it this way
NodeFlags nodeFlags = NodeRuntimeOptions.NODE_FLAGS;
nodeFlags.setCustomFlags(new String[]{"--max-old-space-size=2", "--max-new-space-size=1"});
Do you think 1
or 2
is realistic?
It is indeed unrealistic, but I want to know if this configuration can take effect and what the performance will be like when the memory exceeds the set value
I have tried setting it to a different value, but this restriction does not take effect. If some large data operations are performed, it will still cause OOM
Please leave a repo with the issue.
I set V8Flag to the following parameters
V8Flags v8Flags = NodeRuntimeOptions.V8_FLAGS;
v8Flags.setMaxHeapSize(4);
v8Flags.setMaxOldSpaceSize(4);
Then execute the following JS code
let a = [... new Array (100 * 1000 * 1000).keys()];
It can still execute normally, it seems that the memory limit has not taken effect
When I enlarged the array, there was an OOM exception
<--- Last few GCs --->
[13168:0x7f7e781b0000] 3577 ms: Scavenge 814.7 (831.1) -> 798.7 (831.1) MB, pooled: 0 MB, 0.06 / 0.00 ms (average mu = 0.602, current mu = 0.580) allocation failure;
[13168:0x7f7e781b0000] 3584 ms: Scavenge 814.7 (831.1) -> 798.7 (831.1) MB, pooled: 0 MB, 0.06 / 0.00 ms (average mu = 0.602, current mu = 0.580) allocation failure;
<--- JS stacktrace --->
#
# Fatal error in , line 0
# API fatal error handler returned after process out of memory
#
#
#
#FailureMessage Object: 0x3146fdf30
==== C stack trace ===============================
0 libjavet-v8-macos-x86_64.v.4.1.0.dy 0x000000014c24ecc3 v8::base::debug::StackTrace::StackTrace() + 19
1 libjavet-v8-macos-x86_64.v.4.1.0.dy 0x000000014c25676b v8::platform::(anonymous namespace)::PrintStackTrace() + 27
2 libjavet-v8-macos-x86_64.v.4.1.0.dy 0x000000014c2405b6 V8_Fatal(char const*, ...) + 390
3 libjavet-v8-macos-x86_64.v.4.1.0.dy 0x000000014c261ff5 v8::internal::V8::FatalProcessOutOfMemory(v8::internal::Isolate*, char const*, v8::OOMDetails const&) + 741
4 libjavet-v8-macos-x86_64.v.4.1.0.dy 0x000000014c493657 v8::internal::Heap::FatalProcessOutOfMemory(char const*) + 23
5 libjavet-v8-macos-x86_64.v.4.1.0.dy 0x000000014c8ca56d v8::internal::Runtime_FatalProcessOutOfMemoryInvalidArrayLength(int, unsigned long*, v8::internal::Isolate*) + 29
6 libjavet-v8-macos-x86_64.v.4.1.0.dy 0x000000014d8f75b6 Builtins_CEntry_Return1_ArgvOnStack_NoBuiltinExit + 54
7 libjavet-v8-macos-x86_64.v.4.1.0.dy 0x000000014d8b8a48 Builtins_IterableToList + 1864
8 libjavet-v8-macos-x86_64.v.4.1.0.dy 0x000000014d9f1bae Builtins_CreateArrayFromIterableHandler + 46
9 libjavet-v8-macos-x86_64.v.4.1.0.dy 0x000000014d853e5e Builtins_InterpreterEntryTrampoline + 222
10 libjavet-v8-macos-x86_64.v.4.1.0.dy 0x000000014d853e5e Builtins_InterpreterEntryTrampoline + 222
hi
I used Javert version 4.1.0 and V8 mode
Before initializing V8Runtime, I set some memory parameters in V8Flag to see what happens when the memory limit is exceeded.
Then I executed the following code in V8, but it doesn't seem to have taken effect. I would like to ask if it's because of my incorrect usage.
let a = [... new Array (9000000).keys()];
Also, I would like to ask if it is possible to support passing such a parameter every time V8Runtime is initialized, instead of a globally effective configuration