mirror of
https://gitee.com/openharmony/arkcompiler_ets_runtime
synced 2024-10-07 08:03:29 +00:00
Fixed the OOM but do not throw OOM error
Fixed the OOM but do not throw OOM error Issue: #IAR8U6 Test: Build & Boot devices Signed-off-by: huangzhenghua <huangzhenghua3@huawei.com> Change-Id: Ibe861e996893db670640a7b3c10d89cd165b8488
This commit is contained in:
parent
c74ac12139
commit
615263c667
@ -1097,6 +1097,7 @@ void Heap::CollectGarbage(TriggerGCType gcType, GCReason reason)
|
||||
}
|
||||
if (shouldThrowOOMError_) {
|
||||
// Force Full GC after failed Old GC to avoid OOM
|
||||
LOG_ECMA(INFO) << "Old space is almost OOM, attempt trigger full gc to avoid OOM.";
|
||||
gcType = TriggerGCType::FULL_GC;
|
||||
}
|
||||
oldGCRequested_ = false;
|
||||
|
@ -603,9 +603,12 @@ void AppSpawnSpace::IterateOverMarkedObjects(const std::function<void(TaggedObje
|
||||
uintptr_t LocalSpace::Allocate(size_t size, bool isExpand)
|
||||
{
|
||||
auto object = allocator_->Allocate(size);
|
||||
if (object == 0) {
|
||||
if (isExpand && Expand()) {
|
||||
if (object == 0 && isExpand) {
|
||||
if (Expand()) {
|
||||
object = allocator_->Allocate(size);
|
||||
} else {
|
||||
localHeap_->ThrowOutOfMemoryErrorForDefault(localHeap_->GetJSThread(), size,
|
||||
" LocalSpace::Allocate", false);
|
||||
}
|
||||
}
|
||||
if (object != 0) {
|
||||
|
Loading…
Reference in New Issue
Block a user