"xx free bytes and xx until OOM" 是什么意思?

what does "xx free bytes and xx until OOM" mean?

我的 Android 应用程序java.lang.OutOfMemoryError: Failed to allocate a 32 byte allocation with 0 free bytes and 3GB until OOM 出现了这样的异常。 0 个空闲字节是什么意思?和 3GB?

0 个可用字节正是所说的意思。我不明白的一点是 3GB until next OOM

我通过 Android 源进行了 root,这是你看到这个错误的地方(在 Android 的一些随机版本中,我不确定是哪个)

https://android.googlesource.com/platform/art/+/dd162fb5990cedf80a5093ecc0e77df82af5f754/runtime/gc/heap.cc#872

 oss << "Failed to allocate a " << byte_count << " byte allocation with " << 
 total_bytes_free
 << " free bytes and " << PrettySize(GetFreeMemoryUntilOOME()) << " until OOM";

3GB 是 GetFreeMemoryUntilOOME 函数,看起来是这样的:

// Returns approximately how much free memory we have until the next OOME happens.
size_t GetFreeMemoryUntilOOME() const {
  return growth_limit_ - GetBytesAllocated();
}

我不确定 growth_limit 是什么,但我很高兴看到它是最大堆大小?

我从 Android 来源猜测这确实是一个糟糕的答案,但这里没有其他内容所以我会 post 它!