diff --git a/native/cocos/platform/mac/MacPlatform.mm b/native/cocos/platform/mac/MacPlatform.mm index 722b358f2ed..4d0b0ab84df 100644 --- a/native/cocos/platform/mac/MacPlatform.mm +++ b/native/cocos/platform/mac/MacPlatform.mm @@ -79,12 +79,16 @@ of this software and associated engine source code (the "Software"), a limited, int32_t MacPlatform::loop(void) { #if CC_EDITOR - runTask(); + @autoreleasepool { + runTask(); + } return 1; #else while(!_readyToExit) { - pollEvent(); - runTask(); + @autoreleasepool { + pollEvent(); + runTask(); + } } onDestroy(); return 0; @@ -95,7 +99,9 @@ of this software and associated engine source code (the "Software"), a limited, #if defined(CC_SERVER_MODE) cocos_main(argc, argv); while (true) { - runTask(); + @autoreleasepool { + runTask(); + } } return 0; #else