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
Made it so you can specify the old gen heap size. #15259
Conversation
runtime/dart_vm.cc
Outdated
@@ -111,6 +111,15 @@ static const char* kDartTraceStreamsArgs[] = { | |||
"--timeline_streams=Compiler,Dart,Debugger,Embedder,GC,Isolate,VM,API", | |||
}; | |||
|
|||
static std::string DartOldGenHeapSizeArgs(uint64_t heap_size) { | |||
static const int32_t buffer_size = 100; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use constexpr
(though I believe the compiler will promote this to constexpr anyway)
We'll want to expose this to embedders, but feel free to do that in a separate PR(s). The only requests we've had so far have been for Fuchsia (and likely a customer using the embedder API). |
runtime/dart_vm.cc
Outdated
constexpr int32_t buffer_size = 100; | ||
const char* flag = "--old_gen_heap_size="; | ||
char buffer[buffer_size]; | ||
int result = snprintf(buffer, buffer_size, "%s%lld", flag, heap_size); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
../../flutter/runtime/dart_vm.cc:118:62: error: format specifies type 'long long' but the argument has type 'uint64_t' (aka 'unsigned long') [-Werror,-Wformat]
int result = snprintf(buffer, buffer_size, "%s%lld", flag, heap_size);
~~~~ ^~~~~~~~~
%lu
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
runtime/dart_vm.cc
Outdated
constexpr int32_t buffer_size = 100; | ||
const char* flag = "--old_gen_heap_size="; | ||
char buffer[buffer_size]; | ||
int result = snprintf(buffer, buffer_size, "%s%" PRId64, flag, heap_size); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use std::ostringstream
here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I used snprintf because my concern was binary size. Is there a reason to use string streams?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not really an issue here but snprintf is faster because it works on a fixed size buffer and doesn't have to juggle memory allocations: https://stackoverflow.com/a/445348
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IMHO the code will be simpler with reduced risk of buffer overflows. We already use iostreams in many places throughout the engine, and any performance difference will be negligible given that this is a one time operation during startup of the runtime.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can't get an overflow with snprintf and a buffer with the correct size, but switched to sstream to match other code.
Done. |
Landing with This is an infra problem. |
settings.old_gen_heap_size = 1024; | ||
auto vm = DartVMRef::Create(settings); | ||
// There is no way to introspect on the heap size so we just assert the vm was | ||
// created. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You might try to allocate an array larger than the max size and check it produces an OutOfMemory exception.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
flutter/engine@f001ea2...46adf73 git log f001ea2..46adf73 --first-parent --oneline 2020-01-08 30870216+gaaclarke@users.noreply.github.com Made it so you can specify the old gen heap size. (flutter/engine#15259) 2020-01-08 skia-flutter-autoroll@skia.org Roll fuchsia/sdk/core/mac-amd64 from gL-XG... to rTJJV... (flutter/engine#15308) 2020-01-08 xster@google.com Add a deprecation javadoc note to the old FlutterActivity (flutter/engine#15156) 2020-01-08 31859944+LongCatIsLooong@users.noreply.github.com Bump simulator version in IosUnitTests & scenario app in preparation for luci xcode 11 migration (flutter/engine#15154) 2020-01-08 skia-flutter-autoroll@skia.org Roll src/third_party/skia 91e0d7526944..f811fc331a14 (32 commits) (flutter/engine#15306) If this roll has caused a breakage, revert this CL and stop the roller using the controls here: https://autoroll.skia.org/r/flutter-engine-flutter-autoroll Please CC garyq@google.com on the revert to ensure that a human is aware of the problem. To report a problem with the AutoRoller itself, please file a bug: https://bugs.chromium.org/p/skia/issues/entry?template=Autoroller+Bug Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md
flutter/engine@f001ea2...46adf73 git log f001ea2..46adf73 --first-parent --oneline 2020-01-08 30870216+gaaclarke@users.noreply.github.com Made it so you can specify the old gen heap size. (flutter/engine#15259) 2020-01-08 skia-flutter-autoroll@skia.org Roll fuchsia/sdk/core/mac-amd64 from gL-XG... to rTJJV... (flutter/engine#15308) 2020-01-08 xster@google.com Add a deprecation javadoc note to the old FlutterActivity (flutter/engine#15156) 2020-01-08 31859944+LongCatIsLooong@users.noreply.github.com Bump simulator version in IosUnitTests & scenario app in preparation for luci xcode 11 migration (flutter/engine#15154) 2020-01-08 skia-flutter-autoroll@skia.org Roll src/third_party/skia 91e0d7526944..f811fc331a14 (32 commits) (flutter/engine#15306) If this roll has caused a breakage, revert this CL and stop the roller using the controls here: https://autoroll.skia.org/r/flutter-engine-flutter-autoroll Please CC garyq@google.com on the revert to ensure that a human is aware of the problem. To report a problem with the AutoRoller itself, please file a bug: https://bugs.chromium.org/p/skia/issues/entry?template=Autoroller+Bug Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md
)" This reverts commit 8d790a1.
related issue: https://bugs.fuchsia.dev/p/fuchsia/issues/detail?id=40877#c19