Change the memory warning forced GC to use the level name

Summary:
We're seeing that GCs caused by memory warnings on Android are barely collecting
any memory and are operating on much smaller heaps than natural GCs.

This is likely due to some of the TRIM_MEMORY_* events firing too often.
Log which event name it was, instead of the generic "memory warning", to narrow
down the cases where the memory warning was helpful. Unhelpful warnings will
later be moved to not force a GC.

Note that this diff changes Venice, but we don't see any Venice heaps in production,
so it won't matter much other than making the code match up.

Also note that iOS has a similar memory warning in `RCTCxxBridge.mm`, but it hasn't
been called in production. Perhaps iOS is less trigger-happy for memory warnings than
Android.

Changelog: [Internal]

Reviewed By: neildhar

Differential Revision: D24093394

fbshipit-source-id: 03304f0f79083133c4d9b730559aef291319b6eb
This commit is contained in:
Riley Dulin 2020-10-03 10:08:34 -07:00 коммит произвёл Facebook GitHub Bot
Родитель 5fae86fb96
Коммит 7b7c9f2309
1 изменённых файлов: 1 добавлений и 1 удалений

Просмотреть файл

@ -344,7 +344,7 @@ void JSIExecutor::handleMemoryPressure(int pressureLevel) {
// collections.
LOG(INFO) << "Memory warning (pressure level: " << levelName
<< ") received by JS VM, running a GC";
runtime_->instrumentation().collectGarbage("memory warning");
runtime_->instrumentation().collectGarbage(levelName);
break;
default:
// Use the raw number instead of the name here since the name is