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

[UE] Bug: JsEnvImpl的构造函数在纯v8的环境下没有正确处理传入的InFlags #1629

Closed
3 tasks done
BlurryLight opened this issue Jan 9, 2024 · 4 comments
Closed
3 tasks done
Assignees
Labels
bug Something isn't working Unreal

Comments

@BlurryLight
Copy link
Contributor

前置阅读 | Pre-reading

Puer的版本 | Puer Version

1.0.5

UE的版本 | UE Version

5

发生在哪个平台 | Platform

Editor(win)

错误信息 | Error Message

No response

问题重现 | Bug reproduce

JsEnvImpl的构造函数在纯v8的环境下没有正确处理传入的InFlags

if (!InFlags.IsEmpty())
{
#if !defined(WITH_NODEJS) && !defined(WITH_QUICKJS)
TArray<FString> FlagArray;
InFlags.ParseIntoArray(FlagArray, TEXT(" "));
for (auto& Flag : FlagArray)
{
static FString Max_Old_Space_Size_Name(TEXT("--max-old-space-size="));
if (Flag.StartsWith(Max_Old_Space_Size_Name))
{
size_t Val = FCString::Atoi(*Flag.Mid(Max_Old_Space_Size_Name.Len()));
CreateParams.constraints.set_max_old_generation_size_in_bytes(Val * 1024 * 1024);
}
}
#else
v8::V8::SetFlagsFromString(TCHAR_TO_UTF8(*InFlags));

第359行这个#else会导致 纯v8环境下无法走进去V8::SetFlagsFromString

@BlurryLight BlurryLight added bug Something isn't working Unreal labels Jan 9, 2024
@chexiongsheng
Copy link
Collaborator

都想不起为啥这样写了,可能是笔误吧。。

@chexiongsheng
Copy link
Collaborator

你试了直接去掉else,endif提前生效吗?

@BlurryLight
Copy link
Contributor Author

我是直接把#else那边替换成了#endif。感觉是个笔误。

@chexiongsheng
Copy link
Collaborator

应该不能都调用v8::V8::SetFlagsFromString,这是全局的,而前面那段主要是希望只对单虚拟机生效。
这里直接去掉v8::V8::SetFlagsFromString比较合适,可以另外加个静态函数作为全局生效的接口。

zombieyang pushed a commit to puerts/puerts_experimental_any_engine that referenced this issue Nov 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working Unreal
Projects
None yet
Development

No branches or pull requests

2 participants