⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 254254 in webkit


Ignore:
Timestamp:
Jan 9, 2020, 3:47:31 AM (7 years ago)
Author:
ddkilzer@apple.com
Message:

WebKitTestRunner leaks objects in a top-level autoreleasePool that's never cleared
<​https://webkit.org/b/205950>
<rdar://problem/50987831>

Reviewed by Joseph Pecoraro.

Source/WebKit:

  • UIProcess/mac/WebPreferencesMac.mm:

(WebKit::WebPreferences::platformInitializeStore):

  • Add an @autoreleasepool block around the contents of this method since it generates numerous autoreleased objects when run.

Tools:

  • WebKitTestRunner/ios/mainIOS.mm:

(main):

  • Add an @autoreleasepool block around a line of code that generates autoreleased objects. These objects would never be released for the life of the process prior to this change.
  • WebKitTestRunner/mac/main.mm:

(main):

  • Move instantiation of WTR::TestController outside of @autoreleasepool block so the pool can be drained while running tests. Prior to this change, this autoreleasePool would never be drained.
Location:
trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit/ChangeLog

    r254241 r254254  
     12020-01-09  David Kilzer  <ddkilzer@apple.com>
     2
     3        WebKitTestRunner leaks objects in a top-level autoreleasePool that's never cleared
     4        <https://webkit.org/b/205950>
     5        <rdar://problem/50987831>
     6
     7        Reviewed by Joseph Pecoraro.
     8
     9        * UIProcess/mac/WebPreferencesMac.mm:
     10        (WebKit::WebPreferences::platformInitializeStore):
     11        - Add an @autoreleasepool block around the contents of
     12          this method since it generates numerous autoreleased
     13          objects when run.
     14
    1152020-01-08  Yusuke Suzuki  <ysuzuki@apple.com>
    216
  • trunk/Source/WebKit/UIProcess/mac/WebPreferencesMac.mm

    r247043 r254254  
    139139void WebPreferences::platformInitializeStore()
    140140{
     141    @autoreleasepool {
    141142#define INITIALIZE_DEBUG_PREFERENCE_FROM_NSUSERDEFAULTS(KeyUpper, KeyLower, TypeName, Type, DefaultValue, HumanReadableName, HumanReadableDescription) \
    142     setDebug##TypeName##ValueIfInUserDefaults(m_identifier, m_keyPrefix, m_globalDebugKeyPrefix, WebPreferencesKey::KeyLower##Key(), m_store);
    143 
    144     FOR_EACH_WEBKIT_DEBUG_PREFERENCE(INITIALIZE_DEBUG_PREFERENCE_FROM_NSUSERDEFAULTS)
     143        setDebug##TypeName##ValueIfInUserDefaults(m_identifier, m_keyPrefix, m_globalDebugKeyPrefix, WebPreferencesKey::KeyLower##Key(), m_store);
     144
     145        FOR_EACH_WEBKIT_DEBUG_PREFERENCE(INITIALIZE_DEBUG_PREFERENCE_FROM_NSUSERDEFAULTS)
    145146
    146147#undef INITIALIZE_DEBUG_PREFERENCE_FROM_NSUSERDEFAULTS
    147148
    148     if (!m_identifier)
    149         return;
     149        if (!m_identifier)
     150            return;
    150151
    151152#define INITIALIZE_PREFERENCE_FROM_NSUSERDEFAULTS(KeyUpper, KeyLower, TypeName, Type, DefaultValue, HumanReadableName, HumanReadableDescription) \
    152     Type user##KeyUpper##Value; \
    153     if (platformGet##TypeName##UserValueForKey(WebPreferencesKey::KeyLower##Key(), user##KeyUpper##Value)) \
    154         m_store.set##TypeName##ValueForKey(WebPreferencesKey::KeyLower##Key(), user##KeyUpper##Value);
    155 
    156     FOR_EACH_WEBKIT_PREFERENCE(INITIALIZE_PREFERENCE_FROM_NSUSERDEFAULTS)
     153        Type user##KeyUpper##Value; \
     154        if (platformGet##TypeName##UserValueForKey(WebPreferencesKey::KeyLower##Key(), user##KeyUpper##Value)) \
     155            m_store.set##TypeName##ValueForKey(WebPreferencesKey::KeyLower##Key(), user##KeyUpper##Value);
     156
     157        FOR_EACH_WEBKIT_PREFERENCE(INITIALIZE_PREFERENCE_FROM_NSUSERDEFAULTS)
    157158
    158159#undef INITIALIZE_PREFERENCE_FROM_NSUSERDEFAULTS
     160    }
    159161}
    160162
  • trunk/Tools/ChangeLog

    r254251 r254254  
     12020-01-09  David Kilzer  <ddkilzer@apple.com>
     2
     3        WebKitTestRunner leaks objects in a top-level autoreleasePool that's never cleared
     4        <https://webkit.org/b/205950>
     5        <rdar://problem/50987831>
     6
     7        Reviewed by Joseph Pecoraro.
     8
     9        * WebKitTestRunner/ios/mainIOS.mm:
     10        (main):
     11        - Add an @autoreleasepool block around a line of code
     12          that generates autoreleased objects.  These objects
     13          would never be released for the life of the process
     14          prior to this change.
     15        * WebKitTestRunner/mac/main.mm:
     16        (main):
     17        - Move instantiation of WTR::TestController outside of
     18          @autoreleasepool block so the pool can be drained
     19          while running tests.  Prior to this change, this
     20          autoreleasePool would never be drained.
     21
    1222020-01-08  Saam Barati  <sbarati@apple.com>
    223
  • trunk/Tools/WebKitTestRunner/ios/mainIOS.mm

    r244955 r254254  
    6767    _argv = argv;
    6868
    69     [[NSUserDefaults standardUserDefaults] setBool:YES forKey:@"WebKitLinkedOnOrAfterEverything"];
     69    @autoreleasepool {
     70        [[NSUserDefaults standardUserDefaults] setBool:YES forKey:@"WebKitLinkedOnOrAfterEverything"];
     71    }
    7072
    7173    UIApplicationMain(argc, (char**)argv, @"WebKitTestRunnerApp", @"WebKitTestRunnerApp");
  • trunk/Tools/WebKitTestRunner/mac/main.mm

    r235837 r254254  
    6565        setDefaultsToConsistentValuesForTesting();
    6666        disableAppNapInUIProcess(); // For secondary processes, app nap is disabled using WKPreferencesSetPageVisibilityBasedProcessSuppressionEnabled().
    67         WTR::TestController controller(argc, argv);
    6867    }
     68    WTR::TestController controller(argc, argv);
    6969    return 0;
    7070}
Note: See TracChangeset for help on using the changeset viewer.