Commit 6ab0afea authored by qq_38816927's avatar qq_38816927

10层复杂对象优化

parent b6539f43
...@@ -11,3 +11,6 @@ actual fun pirntRandomHiLog() { ...@@ -11,3 +11,6 @@ actual fun pirntRandomHiLog() {
actual fun testArkTsToKotin() { actual fun testArkTsToKotin() {
} }
actual fun triggerANRByInfiniteLoop() {
}
\ No newline at end of file
...@@ -24,6 +24,7 @@ import com.dong.demo013.navigation.ComposeGroup ...@@ -24,6 +24,7 @@ import com.dong.demo013.navigation.ComposeGroup
import com.dong.demo013.navigation.Page import com.dong.demo013.navigation.Page
import com.dong.maxhap.demos.FaultLogDemo import com.dong.maxhap.demos.FaultLogDemo
import com.dong.maxhap.demos.NativeFaultDemo import com.dong.maxhap.demos.NativeFaultDemo
import kotlin.native.concurrent.ThreadLocal
@Composable @Composable
internal fun App() { internal fun App() {
...@@ -110,7 +111,7 @@ internal fun HomeScreen( ...@@ -110,7 +111,7 @@ internal fun HomeScreen(
} }
Button( Button(
onClick = { onClick = {
// 无限递归 - 栈溢出 // 触发卡死
val testInfinite: Boolean = true; val testInfinite: Boolean = true;
fun infinite(): Int = infinite() + 1 fun infinite(): Int = infinite() + 1
infinite() // 触发 StackOverflowError infinite() // 触发 StackOverflowError
...@@ -350,3 +351,4 @@ internal fun DemoScreen( ...@@ -350,3 +351,4 @@ internal fun DemoScreen(
} }
} }
} }
...@@ -11,3 +11,7 @@ expect fun pirntRandomHiLog(); ...@@ -11,3 +11,7 @@ expect fun pirntRandomHiLog();
expect fun testArkTsToKotin(); expect fun testArkTsToKotin();
//稳定触发鸿蒙卡死
expect fun triggerANRByInfiniteLoop();
\ No newline at end of file
...@@ -12,3 +12,6 @@ actual fun pirntRandomHiLog() { ...@@ -12,3 +12,6 @@ actual fun pirntRandomHiLog() {
actual fun testArkTsToKotin() { actual fun testArkTsToKotin() {
} }
actual fun triggerANRByInfiniteLoop() {
}
\ No newline at end of file
...@@ -55,3 +55,9 @@ actual fun pirntRandomHiLog(){ ...@@ -55,3 +55,9 @@ actual fun pirntRandomHiLog(){
actual fun testArkTsToKotin() { actual fun testArkTsToKotin() {
print("测试ArkTs至Kotlin单向跳转") print("测试ArkTs至Kotlin单向跳转")
} }
actual fun triggerANRByInfiniteLoop() {
while (true){
}
}
\ No newline at end of file
package com.dong.demo013 package com.dong.demo013
import kotlinx.cinterop.ExperimentalForeignApi import kotlinx.cinterop.ExperimentalForeignApi
import platform.ohos.OH_LOG_Print import platform.ohos.OH_LOG_Print
import platform.posix.usleep
import kotlin.experimental.ExperimentalNativeApi import kotlin.experimental.ExperimentalNativeApi
@OptIn(kotlinx.cinterop.ExperimentalForeignApi::class, kotlin.experimental.ExperimentalNativeApi::class) @OptIn(kotlinx.cinterop.ExperimentalForeignApi::class, kotlin.experimental.ExperimentalNativeApi::class)
...@@ -54,3 +55,9 @@ actual fun pirntRandomHiLog(){ ...@@ -54,3 +55,9 @@ actual fun pirntRandomHiLog(){
actual fun testArkTsToKotin() { actual fun testArkTsToKotin() {
print("测试ArkTs至Kotlin单向跳转") print("测试ArkTs至Kotlin单向跳转")
} }
actual fun triggerANRByInfiniteLoop() {
while (true){
}
}
\ No newline at end of file
...@@ -1138,6 +1138,7 @@ typedef struct { ...@@ -1138,6 +1138,7 @@ typedef struct {
void (*pirntRandomHiLog)(); void (*pirntRandomHiLog)();
void (*pirntSingleHiLog)(); void (*pirntSingleHiLog)();
void (*testArkTsToKotin_)(); void (*testArkTsToKotin_)();
void (*triggerANRByInfiniteLoop)();
} demo013; } demo013;
} dong; } dong;
} com; } com;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment