normalizeJsMemoryLimit function
Resolves the public memory-limit contract: zero is unlimited, while null and negative values fall back to the safe default.
Implementation
int normalizeJsMemoryLimit(int? value) {
if (value == 0) return 0;
if (value == null || value < 0) return kDefaultJsMemoryLimit;
return value;
}