在将我们的应用程序与 Gluon 移植到 iOS 之后,我们注意到它在模拟器和真实设备上运行非常缓慢(在我的例子中是运行 iOS7 的 iPad 3)。
我们使用 XCode 提供的分析工具来检查可能的原因并发现了一些内存泄漏。
然后我们尝试了一个基本的 Gluon 项目(Single View,空)并发现了相同的内存泄漏。
我既不是 RoboVM 专家,也不是 JavaFXPorts/Gluon 专家,所以我不知道去哪里找。但是当你告诉我你需要什么时,我可以提供更多信息。
我感谢任何帮助和任何其他建议,以使应用程序更具响应性和更快,因为内存泄漏似乎只是问题的一部分。
这是 XCode 为基本的 HelloWorld 应用程序提供的内存泄漏堆栈跟踪:
Bytes Used # Leaks Symbol Name\
8.72 KB 86.5% 62 start\
8.72 KB 86.5% 62 main\
8.72 KB 86.5% 62 rvmRun\
8.72 KB 86.5% 62 rvmCallVoidClassMethod\
8.72 KB 86.5% 62 rvmCallVoidClassMethodA\
8.72 KB 86.5% 62 callVoidMethod\
8.72 KB 86.5% 62 _call0\
8.72 KB 86.5% 62 [J]org.javafxports.jfxmobile.ios.BasicLauncher.main([Ljava/lang/String;)V\
8.72 KB 86.5% 62 [j]org.robovm.apple.uikit.UIApplication.main([Ljava/lang/String;Ljava/lang/Class;Ljava/lang/Class;)V[clinit]\
8.72 KB 86.5% 62 [J]org.robovm.apple.uikit.UIApplication.main([Ljava/lang/String;Ljava/lang/Class;Ljava/lang/Class;)V\
8.72 KB 86.5% 62 [J]org.robovm.apple.uikit.UIApplication.main(ILorg/robovm/rt/bro/ptr/BytePtr$BytePtrPtr;Ljava/lang/String;Ljava/lang/String;)I\
8.72 KB 86.5% 62 UIApplicationMain\
8.72 KB 86.5% 62 GSEventRunModal\
8.72 KB 86.5% 62 CFRunLoopRunInMode\
8.72 KB 86.5% 62 CFRunLoopRunSpecific\
8.72 KB 86.5% 62 __CFRunLoopRun\
8.72 KB 86.5% 62 __CFRunLoopDoSources0\
8.72 KB 86.5% 62 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__\
8.72 KB 86.5% 62 __NSThreadPerformPerform\
8.72 KB 86.5% 62 -[GlassRunnable run]\
8.72 KB 86.5% 62 CallVoidMethod\
8.72 KB 86.5% 62 rvmCallVoidInstanceMethodA\
8.72 KB 86.5% 62 callVoidMethod\
8.72 KB 86.5% 62 _call0\
8.72 KB 86.5% 62 [J]com.sun.javafx.application.PlatformImpl$$Lambda$6.run()V\
8.72 KB 86.5% 62 [j]com.sun.javafx.application.PlatformImpl.lambda$runLater$174(Ljava/lang/Runnable;Ljava/security/AccessControlContext;)V[clinit]\
8.72 KB 86.5% 62 [J]com.sun.javafx.application.PlatformImpl.lambda$runLater$174(Ljava/lang/Runnable;Ljava/security/AccessControlContext;)V\
8.72 KB 86.5% 62 [j]java.security.AccessController.doPrivileged(Ljava/security/PrivilegedAction;Ljava/security/AccessControlContext;)Ljava/lang/Object;[clinit]\
8.72 KB 86.5% 62 [J]java.security.AccessController.doPrivileged(Ljava/security/PrivilegedAction;Ljava/security/AccessControlContext;)Ljava/lang/Object;\
8.72 KB 86.5% 62 [J]com.sun.javafx.application.PlatformImpl$$Lambda$19.run()Ljava/lang/Object;\
8.72 KB 86.5% 62 [j]com.sun.javafx.application.PlatformImpl.lambda$null$173(Ljava/lang/Runnable;)Ljava/lang/Void;[clinit]\
8.72 KB 86.5% 62 [J]com.sun.javafx.application.PlatformImpl.lambda$null$173(Ljava/lang/Runnable;)Ljava/lang/Void;\
8.72 KB 86.5% 62 [J]com.sun.javafx.application.PlatformImpl$$Lambda$7.run()V\
8.72 KB 86.5% 62 [j]com.sun.javafx.application.PlatformImpl.lambda$runAndWait$175(Ljava/lang/Runnable;Ljava/util/concurrent/CountDownLatch;)V[clinit]\
8.72 KB 86.5% 62 [J]com.sun.javafx.application.PlatformImpl.lambda$runAndWait$175(Ljava/lang/Runnable;Ljava/util/concurrent/CountDownLatch;)V\
8.72 KB 86.5% 62 [J]com.sun.javafx.application.LauncherImpl$$Lambda$9.run()V\
8.72 KB 86.5% 62 [j]com.sun.javafx.application.LauncherImpl.lambda$launchApplication1$162(Ljava/util/concurrent/atomic/AtomicBoolean;Ljavafx/application/Application;)V[clinit]\
8.72 KB 86.5% 62 [J]com.sun.javafx.application.LauncherImpl.lambda$launchApplication1$162(Ljava/util/concurrent/atomic/AtomicBoolean;Ljavafx/application/Application;)V\
8.72 KB 86.5% 62 [J]com.gluonhq.charm.glisten.application.MobileApplication.start(Ljavafx/stage/Stage;)V\
8.72 KB 86.5% 62 [j]java.lang.String.format(Ljava/lang/String;[Ljava/lang/Object;)Ljava/lang/String;[clinit]\
8.72 KB 86.5% 62 [J]java.lang.String.format(Ljava/lang/String;[Ljava/lang/Object;)Ljava/lang/String;\
8.72 KB 86.5% 62 [J]java.lang.String.format(Ljava/util/Locale;Ljava/lang/String;[Ljava/lang/Object;)Ljava/lang/String;\
8.72 KB 86.5% 62 [J]java.util.Formatter.format(Ljava/lang/String;[Ljava/lang/Object;)Ljava/util/Formatter;\
8.72 KB 86.5% 62 [J]java.util.Formatter.format(Ljava/util/Locale;Ljava/lang/String;[Ljava/lang/Object;)Ljava/util/Formatter;\
8.72 KB 86.5% 62 [j]libcore.icu.LocaleData.get(Ljava/util/Locale;)Llibcore/icu/LocaleData;[clinit]\
8.72 KB 86.5% 62 _bcInitializeClass\
8.72 KB 86.5% 62 rvmInitialize\
8.72 KB 86.5% 62 _call0\
8.72 KB 86.5% 62 [J]libcore.icu.LocaleData.<clinit>()V\
8.72 KB 86.5% 62 [J]libcore.icu.LocaleData.get(Ljava/util/Locale;)Llibcore/icu/LocaleData;\
8.72 KB 86.5% 62 [J]libcore.icu.LocaleData.initLocaleData(Ljava/util/Locale;)Llibcore/icu/LocaleData;\
7.31 KB 72.5% 52 [j]libcore.icu.ICU.getBestDateTimePattern(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;[clinit]\
7.31 KB 72.5% 52 [J]libcore.icu.ICU.getBestDateTimePattern(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;\
7.31 KB 72.5% 52 [J]libcore.icu.ICU.getBestDateTimePatternNative(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;\
7.31 KB 72.5% 52 Java_libcore_icu_ICU_getBestDateTimePatternNative\
7.31 KB 72.5% 52 icu_51::DateTimePatternGenerator::createInstance(icu_51::Locale const&, UErrorCode&)\
7.31 KB 72.5% 52 icu_51::DateTimePatternGenerator::DateTimePatternGenerator(icu_51::Locale const&, UErrorCode&)\
6.47 KB 64.1% 46 icu_51::DateTimePatternGenerator::initData(icu_51::Locale const&, UErrorCode&)\
6.47 KB 64.1% 46 icu_51::DateTimePatternGenerator::addICUPatterns(icu_51::Locale const&, UErrorCode&)\
6.47 KB 64.1% 46 icu_51::DateFormat::create(icu_51::DateFormat::EStyle, icu_51::DateFormat::EStyle, icu_51::Locale const&)\
6.47 KB 64.1% 46 icu_51::SimpleDateFormat::SimpleDateFormat(icu_51::DateFormat::EStyle, icu_51::DateFormat::EStyle, icu_51::Locale const&, UErrorCode&)\
6.47 KB 64.1% 46 icu_51::SimpleDateFormat::construct(icu_51::DateFormat::EStyle, icu_51::DateFormat::EStyle, icu_51::Locale const&, UErrorCode&)\
6.47 KB 64.1% 46 icu_51::SimpleDateFormat::initialize(icu_51::Locale const&, UErrorCode&)\
6.47 KB 64.1% 46 icu_51::NumberFormat::makeInstance(icu_51::Locale const&, UNumberFormatStyle, signed char, UErrorCode&)\
6.47 KB 64.1% 46 icu_51::DecimalFormatSymbols::DecimalFormatSymbols(icu_51::Locale const&, UErrorCode&)\
6.47 KB 64.1% 46 icu_51::DecimalFormatSymbols::initialize(icu_51::Locale const&, UErrorCode&, signed char)\
6.47 KB 64.1% 46 ures_open_51\
6.47 KB 64.1% 46 malloc\
6.47 KB 64.1% 46 malloc_zone_malloc\
864 Bytes 8.3% 6 icu_51::DateTimePatternGenerator::setDecimalSymbols(icu_51::Locale const&, UErrorCode&)\
864 Bytes 8.3% 6 icu_51::DecimalFormatSymbols::DecimalFormatSymbols(icu_51::Locale const&, UErrorCode&)\
864 Bytes 8.3% 6 icu_51::DecimalFormatSymbols::initialize(icu_51::Locale const&, UErrorCode&, signed char)\
864 Bytes 8.3% 6 ures_open_51\
864 Bytes 8.3% 6 malloc\
864 Bytes 8.3% 6 malloc_zone_malloc\
1.41 KB 13.9% 10 [j]libcore.icu.ICU.initLocaleDataNative(Ljava/lang/String;Llibcore/icu/LocaleData;)Z[clinit]\
1.41 KB 13.9% 10 [J]libcore.icu.ICU.initLocaleDataNative(Ljava/lang/String;Llibcore/icu/LocaleData;)Z\
1.41 KB 13.9% 10 Java_libcore_icu_ICU_initLocaleDataNative\
1.12 KB 11.1% 8 icu_51::NumberFormat::makeInstance(icu_51::Locale const&, UNumberFormatStyle, signed char, UErrorCode&)\
1.12 KB 11.1% 8 icu_51::DecimalFormatSymbols::DecimalFormatSymbols(icu_51::Locale const&, UErrorCode&)\
1.12 KB 11.1% 8 icu_51::DecimalFormatSymbols::initialize(icu_51::Locale const&, UErrorCode&, signed char)\
1.12 KB 11.1% 8 ures_open_51\
1.12 KB 11.1% 8 malloc\
1.12 KB 11.1% 8 malloc_zone_malloc\
288 Bytes 2.7% 2 icu_51::DecimalFormatSymbols::DecimalFormatSymbols(icu_51::Locale const&, UErrorCode&)\
288 Bytes 2.7% 2 icu_51::DecimalFormatSymbols::initialize(icu_51::Locale const&, UErrorCode&, signed char)\
288 Bytes 2.7% 2 ures_open_51\
288 Bytes 2.7% 2 malloc\
1.36 KB 13.4% 5 thread_start\
1.36 KB 13.4% 5 _pthread_start\
1.36 KB 13.4% 5 _pthread_body\
1.36 KB 13.4% 5 GC_start_routine\
1.36 KB 13.4% 5 GC_call_with_stack_base\
1.36 KB 13.4% 5 GC_inner_start_routine\
1.36 KB 13.4% 5 startThreadEntryPoint\
1.36 KB 13.4% 5 rvmCallVoidInstanceMethodA\
1.36 KB 13.4% 5 callVoidMethod\
1.36 KB 13.4% 5 _call0\
1.36 KB 13.4% 5 [J]java.lang.Thread.run()V\
1.36 KB 13.4% 5 [J]com.sun.javafx.tk.quantum.QuantumRenderer$PipelineRunnable.run()V\
1.36 KB 13.4% 5 [J]java.util.concurrent.ThreadPoolExecutor$Worker.run()V\
1.36 KB 13.4% 5 [J]java.util.concurrent.ThreadPoolExecutor.runWorker(Ljava/util/concurrent/ThreadPoolExecutor$Worker;)V\
1.36 KB 13.4% 5 [J]com.sun.javafx.tk.RenderJob.run()V\
1.36 KB 13.4% 5 [J]java.util.concurrent.FutureTask.runAndReset()Z\
1.36 KB 13.4% 5 [J]java.util.concurrent.Executors$RunnableAdapter.call()Ljava/lang/Object;\
1.36 KB 13.4% 5 [J]com.sun.javafx.tk.quantum.QuantumRenderer$$Lambda$2.run()V\
1.36 KB 13.4% 5 [j]com.sun.javafx.tk.quantum.QuantumRenderer.lambda$createResourceFactory$414()V[clinit]\
1.36 KB 13.4% 5 [J]com.sun.javafx.tk.quantum.QuantumRenderer.lambda$createResourceFactory$414()V\
1.36 KB 13.4% 5 [j]com.sun.prism.GraphicsPipeline.getDefaultResourceFactory()Lcom/sun/prism/ResourceFactory;[clinit]\
1.36 KB 13.4% 5 [J]com.sun.prism.GraphicsPipeline.getDefaultResourceFactory()Lcom/sun/prism/ResourceFactory;\
1.36 KB 13.4% 5 [J]com.sun.prism.es2.ES2Pipeline.getDefaultResourceFactory(Ljava/util/List;)Lcom/sun/prism/ResourceFactory;\
1.36 KB 13.4% 5 [J]com.sun.prism.es2.ES2Pipeline.findDefaultResourceFactory(Ljava/util/List;)Lcom/sun/prism/es2/ES2ResourceFactory;\
1.36 KB 13.4% 5 [J]com.sun.prism.es2.ES2Pipeline.getES2ResourceFactory(ILcom/sun/glass/ui/Screen;)Lcom/sun/prism/es2/ES2ResourceFactory;\
1.36 KB 13.4% 5 [J]com.sun.prism.es2.ES2ResourceFactory.<init>(Lcom/sun/glass/ui/Screen;)V\
1.36 KB 13.4% 5 [J]com.sun.prism.es2.ES2Context.<init>(Lcom/sun/glass/ui/Screen;Lcom/sun/prism/ps/ShaderFactory;)V\
1.36 KB 13.4% 5 [J]com.sun.prism.es2.IOSGLFactory.createGLContext(Lcom/sun/prism/es2/GLDrawable;Lcom/sun/prism/es2/GLPixelFormat;Lcom/sun/prism/es2/GLContext;Z)Lcom/sun/prism/es2/GLContext;\
1.36 KB 13.4% 5 [J]com.sun.prism.es2.IOSGLContext.<init>(Lcom/sun/prism/es2/GLDrawable;Lcom/sun/prism/es2/GLPixelFormat;Lcom/sun/prism/es2/GLContext;Z)V\
1.36 KB 13.4% 5 [J]com.sun.prism.es2.IOSGLContext.nInitialize(JJJZ)J\
1.36 KB 13.4% 5 Java_com_sun_prism_es2_IOSGLContext_nInitialize\
1.08 KB 10.6% 4 strdup\
1.08 KB 10.6% 4 malloc\
288 Bytes 2.7% 1 malloc\