Memory leaks
smiliang opened this issue · comments
Hello erichoracek,
I ran the demo (DynamicThemingExample) on iPhone5s(iOS 12.2),I see lots of memory leaks.
Examples of excerpts are as follows:
0 libsystem_malloc.dylib calloc
1 libobjc.A.dylib cache_t::reallocate(unsigned int, unsigned int)
2 libobjc.A.dylib cache_fill
3 libobjc.A.dylib lookUpImpOrForward
4 libobjc.A.dylib _objc_msgSend_uncached
5 Motif -[MTFThemeClass applyTo:error:] /data/UIDemos/Motif/Motif/Core/MTFThemeClass.m:188
6 Motif -[MTFTheme applyClassWithName:to:error:] /data/UIDemos/Motif/Motif/Core/MTFTheme.m:162
7 Motif -[MTFDynamicThemeApplier applyClassWithName:to:error:] /data/UIDemos/Motif/Motif/Core/MTFDynamicThemeApplier.m:78
8 Motif -[MTFDynamicThemeApplier applyTheme:toApplicants:error:] /data/UIDemos/Motif/Motif/Core/MTFDynamicThemeApplier.m:59
9 Motif -[MTFDynamicThemeApplier setTheme:error:] /data/UIDemos/Motif/Motif/Core/MTFDynamicThemeApplier.m:47
10 DynamicThemingExample -[AppDelegate toggleTheme] /data/UIDemos/Motif/Examples/DynamicThemingExample/AppDelegate.m:137
11 UIKitCore -[UIApplication sendAction:to:from:forEvent:]
12 UIKitCore __45-[_UIButtonBarTargetAction _invoke:forEvent:]_block_invoke
13 UIKitCore -[_UIButtonBarTargetAction _invoke:forEvent:]
14 UIKitCore -[UIApplication sendAction:to:from:forEvent:]
15 UIKitCore -[UIControl sendAction:to:forEvent:]
16 UIKitCore -[UIControl _sendActionsForEvents:withEvent:]
17 UIKitCore -[UIControl touchesEnded:withEvent:]
18 UIKitCore -[UIWindow _sendTouchesForEvent:]
19 UIKitCore -[UIWindow sendEvent:]
20 UIKitCore -[UIApplication sendEvent:]
21 UIKitCore __dispatchPreprocessedEventFromEventQueue
22 UIKitCore __handleEventQueueInternal
23 UIKitCore __handleHIDEventFetcherDrain
24 CoreFoundation CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION
25 CoreFoundation __CFRunLoopDoSource0
26 CoreFoundation __CFRunLoopDoSources0
27 CoreFoundation __CFRunLoopRun
28 CoreFoundation CFRunLoopRunSpecific
29 GraphicsServices GSEventRunModal
30 UIKitCore UIApplicationMain
31 DynamicThemingExample main /data/UIDemos/Motif/Examples/DynamicThemingExample/main.m:14
32 libdyld.dylib start
0 libsystem_malloc.dylib calloc
1 libobjc.A.dylib cache_t::reallocate(unsigned int, unsigned int)
2 libobjc.A.dylib cache_fill
3 libobjc.A.dylib lookupMethodInClassAndLoadCache
4 libobjc.A.dylib object_cxxDestructFromClass(objc_object*, objc_class*)
5 libobjc.A.dylib objc_destructInstance
6 libobjc.A.dylib object_dispose
7 libobjc.A.dylib -[NSObject release]
8 libobjc.A.dylib _object_set_associative_reference
9 Motif -[NSObject(ThemeClassName) mtf_setThemeClass:] /data/UIDemos/Motif/Motif/Core/NSObject+ThemeClass.m:52
10 Motif -[MTFThemeClass applyTo:error:] /data/UIDemos/Motif/Motif/Core/MTFThemeClass.m:294
11 DynamicThemingExample __25+[UIButton(Theming) load]_block_invoke /data/UIDemos/Motif/Examples/DynamicThemingExample/ThemingCategories/UIButton+Theming.m:24
12 Motif -[MTFThemeClassValueClassPropertyApplier applyClass:to:error:] /data/UIDemos/Motif/Motif/Core/MTFThemeClassPropertyApplier.m:89
13 Motif -[MTFThemeClass applyTo:error:] /data/UIDemos/Motif/Motif/Core/MTFThemeClass.m:73
14 Motif -[MTFThemeClass applyTo:error:] /data/UIDemos/Motif/Motif/Core/MTFThemeClass.m:203
15 Motif -[MTFTheme applyClassWithName:to:error:] /data/UIDemos/Motif/Motif/Core/MTFTheme.m:162
16 Motif -[MTFDynamicThemeApplier applyClassWithName:to:error:] /data/UIDemos/Motif/Motif/Core/MTFDynamicThemeApplier.m:78
17 Motif -[MTFDynamicThemeApplier applyTheme:toApplicants:error:] /data/UIDemos/Motif/Motif/Core/MTFDynamicThemeApplier.m:59
18 Motif -[MTFDynamicThemeApplier setTheme:error:] /data/UIDemos/Motif/Motif/Core/MTFDynamicThemeApplier.m:47
19 DynamicThemingExample -[AppDelegate toggleTheme] /data/UIDemos/Motif/Examples/DynamicThemingExample/AppDelegate.m:139
20 UIKitCore -[UIApplication sendAction:to:from:forEvent:]
21 UIKitCore __45-[_UIButtonBarTargetAction _invoke:forEvent:]_block_invoke
22 UIKitCore -[_UIButtonBarTargetAction _invoke:forEvent:]
23 UIKitCore -[UIApplication sendAction:to:from:forEvent:]
24 UIKitCore -[UIControl sendAction:to:forEvent:]
25 UIKitCore -[UIControl _sendActionsForEvents:withEvent:]
26 UIKitCore -[UIControl touchesEnded:withEvent:]
27 UIKitCore -[UIWindow _sendTouchesForEvent:]
28 UIKitCore -[UIWindow sendEvent:]
29 UIKitCore -[UIApplication sendEvent:]
30 UIKitCore __dispatchPreprocessedEventFromEventQueue
31 UIKitCore __handleEventQueueInternal
32 CoreFoundation CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION
33 CoreFoundation __CFRunLoopDoSource0
34 CoreFoundation __CFRunLoopDoSources0
35 CoreFoundation __CFRunLoopRun
36 CoreFoundation CFRunLoopRunSpecific
37 GraphicsServices GSEventRunModal
38 UIKitCore UIApplicationMain
39 DynamicThemingExample main /data/UIDemos/Motif/Examples/DynamicThemingExample/main.m:14
40 libdyld.dylib start
PS:I tested on iOS simulator, there is no memory leak on iOS 11.0.1 and iOS 12.0. The iOS simulator12.2 also has memory leaks.