mirror of
https://gitee.com/openharmony/arkcompiler_ets_runtime
synced 2024-11-27 04:00:37 +00:00
!10077 StatisticHeapDetail 栈溢出问题
Merge pull request !10077 from jinjiawei/stack-check-fail
This commit is contained in:
commit
915632ea3d
@ -400,8 +400,8 @@ void JSThread::IterateHandleWithCheck(const RootVisitor &visitor, const RootRang
|
||||
}
|
||||
|
||||
size_t globalCount = 0;
|
||||
static const int JS_TYPE_LAST = static_cast<int>(JSType::TYPE_LAST);
|
||||
int typeCount[JS_TYPE_LAST] = { 0 };
|
||||
static const int JS_TYPE_SUM = static_cast<int>(JSType::TYPE_LAST) + 1;
|
||||
int typeCount[JS_TYPE_SUM] = { 0 };
|
||||
int primitiveCount = 0;
|
||||
bool isStopObjectLeakCheck = EnableGlobalObjectLeakCheck() && !IsStartGlobalLeakCheck() && stackTraceFd_ > 0;
|
||||
bool isStopPrimitiveLeakCheck = EnableGlobalPrimitiveLeakCheck() && !IsStartGlobalLeakCheck() && stackTraceFd_ > 0;
|
||||
@ -450,7 +450,7 @@ void JSThread::IterateHandleWithCheck(const RootVisitor &visitor, const RootRang
|
||||
OPTIONAL_LOG(GetEcmaVM(), INFO) << "Global type Primitive count:" << primitiveCount;
|
||||
// Print global object type statistic.
|
||||
static const int MIN_COUNT_THRESHOLD = 50;
|
||||
for (int i = 0; i < JS_TYPE_LAST; i++) {
|
||||
for (int i = 0; i < JS_TYPE_SUM; i++) {
|
||||
if (typeCount[i] > MIN_COUNT_THRESHOLD) {
|
||||
OPTIONAL_LOG(GetEcmaVM(), INFO) << "Global type " << JSHClass::DumpJSType(JSType(i))
|
||||
<< " count:" << typeCount[i];
|
||||
|
@ -43,6 +43,7 @@ namespace panda::ecmascript {
|
||||
if ((space)->IsOOMDumpSpace()) { \
|
||||
DumpHeapSnapshotBeforeOOM(); \
|
||||
} \
|
||||
StatisticHeapDetail(); \
|
||||
ThrowOutOfMemoryError(GetJSThread(), size, message); \
|
||||
(object) = reinterpret_cast<TaggedObject *>((space)->Allocate(size)); \
|
||||
}
|
||||
@ -436,6 +437,7 @@ TaggedObject *Heap::AllocateHugeObject(size_t size)
|
||||
size_t oomOvershootSize = config_.GetOutOfMemoryOvershootSize();
|
||||
oldSpace_->IncreaseOutOfMemoryOvershootSize(oomOvershootSize);
|
||||
DumpHeapSnapshotBeforeOOM();
|
||||
StatisticHeapDetail();
|
||||
object = reinterpret_cast<TaggedObject *>(hugeObjectSpace_->Allocate(size, thread_));
|
||||
ThrowOutOfMemoryError(thread_, size, "Heap::AllocateHugeObject");
|
||||
object = reinterpret_cast<TaggedObject *>(hugeObjectSpace_->Allocate(size, thread_));
|
||||
|
@ -1271,6 +1271,7 @@ void Heap::CollectGarbage(TriggerGCType gcType, GCReason reason)
|
||||
oldSpace_->ResetCommittedOverSizeLimit();
|
||||
if (oldSpace_->CommittedSizeExceed()) { // LCOV_EXCL_BR_LINE
|
||||
DumpHeapSnapshotBeforeOOM(false);
|
||||
StatisticHeapDetail();
|
||||
ThrowOutOfMemoryError(thread_, oldSpace_->GetMergeSize(), " OldSpace::Merge");
|
||||
}
|
||||
oldSpace_->ResetMergeSize();
|
||||
@ -1384,6 +1385,7 @@ void Heap::CheckNonMovableSpaceOOM()
|
||||
if (nonMovableSpace_->GetHeapObjectSize() > MAX_NONMOVABLE_LIVE_OBJ_SIZE) { // LCOV_EXCL_BR_LINE
|
||||
sweeper_->EnsureAllTaskFinished();
|
||||
DumpHeapSnapshotBeforeOOM(false);
|
||||
StatisticHeapDetail();
|
||||
ThrowOutOfMemoryError(thread_, nonMovableSpace_->GetHeapObjectSize(), "Heap::CheckNonMovableSpaceOOM", true);
|
||||
}
|
||||
}
|
||||
@ -2561,14 +2563,14 @@ void Heap::StatisticHeapObject(TriggerGCType gcType) const
|
||||
void Heap::StatisticHeapDetail()
|
||||
{
|
||||
Prepare();
|
||||
static const int JS_TYPE_LAST = static_cast<int>(JSType::TYPE_LAST);
|
||||
int typeCount[JS_TYPE_LAST] = { 0 };
|
||||
static const int JS_TYPE_SUM = static_cast<int>(JSType::TYPE_LAST) + 1;
|
||||
int typeCount[JS_TYPE_SUM] = { 0 };
|
||||
static const int MIN_COUNT_THRESHOLD = 1000;
|
||||
|
||||
nonMovableSpace_->IterateOverObjects([&typeCount] (TaggedObject *object) {
|
||||
typeCount[static_cast<int>(object->GetClass()->GetObjectType())]++;
|
||||
});
|
||||
for (int i = 0; i < JS_TYPE_LAST; i++) {
|
||||
for (int i = 0; i < JS_TYPE_SUM; i++) {
|
||||
if (typeCount[i] > MIN_COUNT_THRESHOLD) {
|
||||
LOG_ECMA(INFO) << "NonMovable space type " << JSHClass::DumpJSType(JSType(i))
|
||||
<< " count:" << typeCount[i];
|
||||
@ -2579,7 +2581,7 @@ void Heap::StatisticHeapDetail()
|
||||
oldSpace_->IterateOverObjects([&typeCount] (TaggedObject *object) {
|
||||
typeCount[static_cast<int>(object->GetClass()->GetObjectType())]++;
|
||||
});
|
||||
for (int i = 0; i < JS_TYPE_LAST; i++) {
|
||||
for (int i = 0; i < JS_TYPE_SUM; i++) {
|
||||
if (typeCount[i] > MIN_COUNT_THRESHOLD) {
|
||||
LOG_ECMA(INFO) << "Old space type " << JSHClass::DumpJSType(JSType(i))
|
||||
<< " count:" << typeCount[i];
|
||||
@ -2590,7 +2592,7 @@ void Heap::StatisticHeapDetail()
|
||||
activeSemiSpace_->IterateOverObjects([&typeCount] (TaggedObject *object) {
|
||||
typeCount[static_cast<int>(object->GetClass()->GetObjectType())]++;
|
||||
});
|
||||
for (int i = 0; i < JS_TYPE_LAST; i++) {
|
||||
for (int i = 0; i < JS_TYPE_SUM; i++) {
|
||||
if (typeCount[i] > MIN_COUNT_THRESHOLD) {
|
||||
LOG_ECMA(INFO) << "Active semi space type " << JSHClass::DumpJSType(JSType(i))
|
||||
<< " count:" << typeCount[i];
|
||||
|
@ -189,6 +189,7 @@ private:
|
||||
<< sheap_->GetHugeObjectSpace()->GetCommittedSize();
|
||||
} else {
|
||||
if (dump) {
|
||||
heap_->StatisticHeapDetail();
|
||||
heap_->DumpHeapSnapshotBeforeOOM();
|
||||
}
|
||||
LOG_ECMA(FATAL) << "BaseDeserializer::OutOfMemory when deserialize obj size: " << size
|
||||
|
Loading…
Reference in New Issue
Block a user