Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reduce usage of autorelease pools #968

Merged
merged 4 commits into from
Jun 15, 2018
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
- Internal housekeeping on the async transaction (rendering) system. [Adlai Holler](https://github.com/Adlai-Holler)
- Add new protocol `ASLocking` that extends `NSLocking` with `tryLock`, and allows taking multiple locks safely. [Adlai Holler](https://github.com/Adlai-Holler)
- Make the main thread ivar deallocation system available to other classes. Plus a little optimization. See `ASMainThreadDeallocation.h`. [Adlai Holler](https://github.com/Adlai-Holler) [#959](https://github.com/TextureGroup/Texture/pull/959)
- Reduce usage of autorelease pools. [Adlai Holler](https://github.com/Adlai-Holler) [#968](https://github.com/TextureGroup/Texture/pull/968)

## 2.7
- Fix pager node for interface coalescing. [Max Wang](https://github.com/wsdwsd0829) [#877](https://github.com/TextureGroup/Texture/pull/877)
Expand Down
6 changes: 3 additions & 3 deletions Source/ASCollectionView.mm
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,7 @@ - (instancetype)_initWithFrame:(CGRect)frame collectionViewLayout:(UICollectionV
_proxyDataSource = [[ASCollectionViewProxy alloc] initWithTarget:nil interceptor:self];
super.dataSource = (id<UICollectionViewDataSource>)_proxyDataSource;

_registeredSupplementaryKinds = [NSMutableSet set];
_registeredSupplementaryKinds = [[NSMutableSet alloc] init];
_visibleElements = [[NSCountedSet alloc] init];

_cellsForVisibilityUpdates = [NSHashTable hashTableWithOptions:NSHashTableObjectPointerPersonality];
Expand Down Expand Up @@ -1729,7 +1729,7 @@ - (void)layoutSubviews
NSArray<ASCellNode *> *nodes = [_cellsForLayoutUpdates allObjects];
[_cellsForLayoutUpdates removeAllObjects];

NSMutableArray<ASCellNode *> *nodesSizeChanged = [NSMutableArray array];
NSMutableArray<ASCellNode *> *nodesSizeChanged = [[NSMutableArray alloc] init];

[_dataController relayoutNodes:nodes nodesSizeChanged:nodesSizeChanged];
[self nodesDidRelayout:nodesSizeChanged];
Expand Down Expand Up @@ -2005,7 +2005,7 @@ - (ASCellNodeBlock)dataController:(ASDataController *)dataController supplementa
- (NSArray<NSString *> *)dataController:(ASDataController *)dataController supplementaryNodeKindsInSections:(NSIndexSet *)sections
{
if (_asyncDataSourceFlags.collectionNodeSupplementaryElementKindsInSection) {
NSMutableSet *kinds = [NSMutableSet set];
auto kinds = [[NSMutableSet<NSString *> alloc] init];
GET_COLLECTIONNODE_OR_RETURN(collectionNode, @[]);
[sections enumerateIndexesUsingBlock:^(NSUInteger section, BOOL * _Nonnull stop) {
NSArray<NSString *> *kindsForSection = [_asyncDataSource collectionNode:collectionNode supplementaryElementKindsInSection:section];
Expand Down
6 changes: 3 additions & 3 deletions Source/ASDisplayNode+Layout.mm
Original file line number Diff line number Diff line change
Expand Up @@ -767,10 +767,10 @@ - (void)animateLayoutTransition:(id<ASContextTransitioning>)context

NSArray<ASDisplayNode *> *removedSubnodes = [context removedSubnodes];
NSMutableArray<ASDisplayNode *> *insertedSubnodes = [[context insertedSubnodes] mutableCopy];
NSMutableArray<ASDisplayNode *> *movedSubnodes = [NSMutableArray array];
auto movedSubnodes = [[NSMutableArray<ASDisplayNode *> alloc] init];

NSMutableArray<_ASAnimatedTransitionContext *> *insertedSubnodeContexts = [NSMutableArray array];
NSMutableArray<_ASAnimatedTransitionContext *> *removedSubnodeContexts = [NSMutableArray array];
auto insertedSubnodeContexts = [[NSMutableArray<_ASAnimatedTransitionContext *> alloc] init];
auto removedSubnodeContexts = [[NSMutableArray<_ASAnimatedTransitionContext *> alloc] init];

for (ASDisplayNode *subnode in [context subnodesForKey:ASTransitionContextToLayoutKey]) {
if ([insertedSubnodes containsObject:subnode] == NO) {
Expand Down
2 changes: 1 addition & 1 deletion Source/ASDisplayNode+Yoga.mm
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ - (void)insertYogaChild:(ASDisplayNode *)child atIndex:(NSUInteger)index
return;
}
if (_yogaChildren == nil) {
_yogaChildren = [NSMutableArray array];
_yogaChildren = [[NSMutableArray alloc] init];
}

// Clean up state in case this child had another parent.
Expand Down
4 changes: 2 additions & 2 deletions Source/ASDisplayNodeExtras.mm
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ static void _ASCollectDisplayNodes(NSMutableArray *array, CALayer *layer)

extern NSArray<ASDisplayNode *> *ASCollectDisplayNodes(ASDisplayNode *node)
{
NSMutableArray *list = [NSMutableArray array];
NSMutableArray *list = [[NSMutableArray alloc] init];
for (CALayer *sublayer in node.layer.sublayers) {
_ASCollectDisplayNodes(list, sublayer);
}
Expand All @@ -203,7 +203,7 @@ static void _ASDisplayNodeFindAllSubnodes(NSMutableArray *array, ASDisplayNode *

extern NSArray<ASDisplayNode *> *ASDisplayNodeFindAllSubnodes(ASDisplayNode *start, BOOL (^block)(ASDisplayNode *node))
{
NSMutableArray *list = [NSMutableArray array];
NSMutableArray *list = [[NSMutableArray alloc] init];
_ASDisplayNodeFindAllSubnodes(list, start, block);
return list;
}
Expand Down
6 changes: 3 additions & 3 deletions Source/ASNetworkImageNode.mm
Original file line number Diff line number Diff line change
Expand Up @@ -629,20 +629,20 @@ - (void)_lazilyLoadImageIfNecessary
} else {
// First try to load the path directly, for efficiency assuming a developer who
// doesn't want caching is trying to be as minimal as possible.
UIImage *nonAnimatedImage = [UIImage imageWithContentsOfFile:URL.path];
auto nonAnimatedImage = [[UIImage alloc] initWithContentsOfFile:URL.path];
if (nonAnimatedImage == nil) {
// If we couldn't find it, execute an -imageNamed:-like search so we can find resources even if the
// extension is not provided in the path. This allows the same path to work regardless of shouldCacheImage.
NSString *filename = [[NSBundle mainBundle] pathForResource:URL.path.lastPathComponent ofType:nil];
if (filename != nil) {
nonAnimatedImage = [UIImage imageWithContentsOfFile:filename];
nonAnimatedImage = [[UIImage alloc] initWithContentsOfFile:filename];
}
}

// If the file may be an animated gif and then created an animated image.
id<ASAnimatedImageProtocol> animatedImage = nil;
if (_downloaderFlags.downloaderImplementsAnimatedImage) {
NSData *data = [NSData dataWithContentsOfURL:URL];
auto data = [[NSData alloc] initWithContentsOfURL:URL];
if (data != nil) {
animatedImage = [_downloader animatedImageWithData:data];

Expand Down
14 changes: 6 additions & 8 deletions Source/ASRunLoopQueue.mm
Original file line number Diff line number Diff line change
Expand Up @@ -238,14 +238,12 @@ - (void)releaseObjectInBackground:(id _Nullable __strong *)objectPtr

- (void)drain
{
@autoreleasepool {
_lock.lock();
auto q = std::move(_queue);
_lock.unlock();
for (auto ref : q) {
// NOTE: Could check that retain count is 1 and retry later if not.
CFRelease(ref);
}
_lock.lock();
auto q = std::move(_queue);
_lock.unlock();
for (auto ref : q) {
// NOTE: Could check that retain count is 1 and retry later if not.
CFRelease(ref);
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was silly for putting this in in the first place. Creating autorelease pools takes a lot of time and there's absolutely no chance of anything getting added to it in here 🤦‍♂️

}
}

Expand Down
2 changes: 1 addition & 1 deletion Source/ASTableView.mm
Original file line number Diff line number Diff line change
Expand Up @@ -758,7 +758,7 @@ - (void)layoutSubviews
NSArray<ASCellNode *> *nodes = [_cellsForLayoutUpdates allObjects];
[_cellsForLayoutUpdates removeAllObjects];

NSMutableArray<ASCellNode *> *nodesSizeChanged = [NSMutableArray array];
auto nodesSizeChanged = [[NSMutableArray<ASCellNode *> alloc] init];
[_dataController relayoutNodes:nodes nodesSizeChanged:nodesSizeChanged];
if (nodesSizeChanged.count > 0) {
[self requeryNodeHeights];
Expand Down
2 changes: 1 addition & 1 deletion Source/ASTextNode.mm
Original file line number Diff line number Diff line change
Expand Up @@ -854,7 +854,7 @@ - (NSArray *)_rectsForTextRange:(NSRange)textRange measureOption:(ASTextKitRende
ASLockScopeSelf();

NSArray *rects = [[self _locked_renderer] rectsForTextRange:textRange measureOption:measureOption];
NSMutableArray *adjustedRects = [NSMutableArray array];
auto adjustedRects = [[NSMutableArray<NSValue *> alloc] init];

for (NSValue *rectValue in rects) {
CGRect rect = [rectValue CGRectValue];
Expand Down
8 changes: 5 additions & 3 deletions Source/Base/ASBaseDefines.h
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@
* Create a new set by mapping `collection` over `work`, ignoring nil.
*/
#define ASSetByFlatMapping(collection, decl, work) ({ \
NSMutableSet *s = [NSMutableSet set]; \
NSMutableSet *s = [[NSMutableSet alloc] init]; \
for (decl in collection) {\
id result = work; \
if (result != nil) { \
Expand All @@ -271,9 +271,11 @@

/**
* Create a new ObjectPointerPersonality NSHashTable by mapping `collection` over `work`, ignoring nil.
*
* capacity: 0 is taken from +hashTableWithOptions.
*/
#define ASPointerTableByFlatMapping(collection, decl, work) ({ \
NSHashTable *t = [NSHashTable hashTableWithOptions:NSHashTableObjectPointerPersonality]; \
NSHashTable *t = [[NSHashTable alloc] initWithOptions:NSHashTableObjectPointerPersonality capacity:0]; \
for (decl in collection) {\
id result = work; \
if (result != nil) { \
Expand All @@ -287,7 +289,7 @@
* Create a new array by mapping `collection` over `work`, ignoring nil.
*/
#define ASArrayByFlatMapping(collection, decl, work) ({ \
NSMutableArray *a = [NSMutableArray array]; \
NSMutableArray *a = [[NSMutableArray alloc] init]; \
for (decl in collection) {\
id result = work; \
if (result != nil) { \
Expand Down
2 changes: 1 addition & 1 deletion Source/Details/ASBasicImageDownloader.mm
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ - (id)downloadImageWithURL:(NSURL *)URL
// cause significant performance issues.
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
// associate metadata with it
NSMutableDictionary *callbackData = [NSMutableDictionary dictionary];
NSMutableDictionary *callbackData = [[NSMutableDictionary alloc] init];
callbackData[kASBasicImageDownloaderContextCallbackQueue] = callbackQueue ? : dispatch_get_main_queue();

if (downloadProgress) {
Expand Down
6 changes: 3 additions & 3 deletions Source/Details/ASCollectionLayoutState.mm
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ - (UICollectionViewLayoutAttributes *)layoutAttributesForElement:(ASCollectionEl
}

// Use a set here because some items may span multiple pages
NSMutableSet<UICollectionViewLayoutAttributes *> *result = [NSMutableSet set];
auto result = [NSMutableSet<UICollectionViewLayoutAttributes *> set];
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use alloc init in here too?

for (id pagePtr in pages) {
ASPageCoordinate page = (ASPageCoordinate)pagePtr;
NSArray<UICollectionViewLayoutAttributes *> *allAttrs = [_pageToLayoutAttributesTable objectForPage:page];
Expand Down Expand Up @@ -216,7 +216,7 @@ - (ASPageToLayoutAttributesTable *)getAndRemoveUnmeasuredLayoutAttributesPageTab
for (UICollectionViewLayoutAttributes *attrs in attrsInPage) {
if (CGRectIntersectsRect(rect, attrs.frame)) {
if (intersectingAttrsInPage == nil) {
intersectingAttrsInPage = [NSMutableArray array];
intersectingAttrsInPage = [[NSMutableArray alloc] init];
}
[intersectingAttrsInPage addObject:attrs];
}
Expand Down Expand Up @@ -245,7 +245,7 @@ + (ASPageToLayoutAttributesTable *)_unmeasuredLayoutAttributesTableFromTable:(NS
contentSize:(CGSize)contentSize
pageSize:(CGSize)pageSize
{
NSMutableArray<UICollectionViewLayoutAttributes *> *unmeasuredAttrs = [NSMutableArray array];
NSMutableArray<UICollectionViewLayoutAttributes *> *unmeasuredAttrs = [[NSMutableArray alloc] init];
for (ASCollectionElement *element in table) {
UICollectionViewLayoutAttributes *attrs = [table objectForKey:element];
if (element.nodeIfAllocated == nil || CGSizeEqualToSize(element.nodeIfAllocated.calculatedSize, attrs.frame.size) == NO) {
Expand Down
6 changes: 3 additions & 3 deletions Source/Details/ASDataController.mm
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ - (instancetype)initWithDataSource:(id<ASDataControllerSource>)dataSource node:(
_mainSerialQueue = [[ASMainSerialQueue alloc] init];

_synchronized = YES;
_onDidFinishSynchronizingBlocks = [NSMutableSet set];
_onDidFinishSynchronizingBlocks = [[NSMutableSet alloc] init];

const char *queueName = [[NSString stringWithFormat:@"org.AsyncDisplayKit.ASDataController.editingTransactionQueue:%p", self] cStringUsingEncoding:NSASCIIStringEncoding];
_editingTransactionQueue = dispatch_queue_create(queueName, DISPATCH_QUEUE_SERIAL);
Expand Down Expand Up @@ -214,7 +214,7 @@ - (void)_layoutNode:(ASCellNode *)node withConstrainedSize:(ASSizeRange)constrai
return @[];
}

NSMutableArray<NSIndexPath *> *indexPaths = [NSMutableArray array];
auto indexPaths = [[NSMutableArray<NSIndexPath *> alloc] init];
if ([kind isEqualToString:ASDataControllerRowNodeKind]) {
std::vector<NSInteger> counts = [self itemCountsFromDataSource];
[sections enumerateRangesUsingBlock:^(NSRange range, BOOL * _Nonnull stop) {
Expand Down Expand Up @@ -671,7 +671,7 @@ - (void)updateWithChangeSet:(_ASHierarchyChangeSet *)changeSet
[layoutDelegateClass calculateLayoutWithContext:layoutContext];
completion();
} else {
NSMutableArray<ASCollectionElement *> *elementsToProcess = [NSMutableArray array];
auto elementsToProcess = [[NSMutableArray<ASCollectionElement *> alloc] init];
for (ASCollectionElement *element in newMap) {
ASCellNode *nodeIfAllocated = element.nodeIfAllocated;
if (nodeIfAllocated.shouldUseUIKitCell) {
Expand Down
2 changes: 1 addition & 1 deletion Source/Details/ASPageTable.m
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ + (ASPageToLayoutAttributesTable *)pageTableWithLayoutAttributes:(id<NSFastEnume
ASPageCoordinate page = (ASPageCoordinate)pagePtr;
NSMutableArray<UICollectionViewLayoutAttributes *> *attrsInPage = [result objectForPage:page];
if (attrsInPage == nil) {
attrsInPage = [NSMutableArray array];
attrsInPage = [[NSMutableArray alloc] init];
[result setObject:attrsInPage forPage:page];
}
[attrsInPage addObject:attrs];
Expand Down
6 changes: 3 additions & 3 deletions Source/Details/NSArray+Diffing.m
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ - (void)asdk_diffWithArray:(NSArray *)array insertions:(NSIndexSet **)insertions

if (insertions) {
NSArray *commonObjects = [self objectsAtIndexes:commonIndexes];
NSMutableIndexSet *insertionIndexes = [NSMutableIndexSet indexSet];
NSMutableIndexSet *insertionIndexes = [[NSMutableIndexSet alloc] init];
for (NSInteger i = 0, j = 0; i < commonObjects.count || j < array.count;) {
if (i < commonObjects.count && j < array.count && comparison(commonObjects[i], array[j])) {
i++; j++;
Expand All @@ -47,7 +47,7 @@ - (void)asdk_diffWithArray:(NSArray *)array insertions:(NSIndexSet **)insertions
}

if (deletions) {
NSMutableIndexSet *deletionIndexes = [NSMutableIndexSet indexSet];
NSMutableIndexSet *deletionIndexes = [[NSMutableIndexSet alloc] init];
for (NSInteger i = 0; i < self.count; i++) {
if (![commonIndexes containsIndex:i]) {
[deletionIndexes addIndex:i];
Expand Down Expand Up @@ -90,7 +90,7 @@ - (NSIndexSet *)_asdk_commonIndexesWithArray:(NSArray *)array compareBlock:(BOOL
}
}

NSMutableIndexSet *common = [NSMutableIndexSet indexSet];
NSMutableIndexSet *common = [[NSMutableIndexSet alloc] init];
NSInteger i = selfCount, j = arrayCount;
while(i > 0 && j > 0) {
if (comparison(self[i-1], array[j-1])) {
Expand Down
2 changes: 0 additions & 2 deletions Source/Details/NSIndexSet+ASHelpers.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,4 @@
/// Returns all the section indexes contained in the index paths array.
+ (NSIndexSet *)as_sectionsFromIndexPaths:(NSArray<NSIndexPath *> *)indexPaths;

- (NSArray<NSIndexPath *> *)as_filterIndexPathsBySection:(id<NSFastEnumeration>)indexPaths;

@end
19 changes: 4 additions & 15 deletions Source/Details/NSIndexSet+ASHelpers.m
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ @implementation NSIndexSet (ASHelpers)

- (NSIndexSet *)as_indexesByMapping:(NSUInteger (^)(NSUInteger))block
{
NSMutableIndexSet *result = [NSMutableIndexSet indexSet];
NSMutableIndexSet *result = [[NSMutableIndexSet alloc] init];
[self enumerateRangesUsingBlock:^(NSRange range, BOOL * _Nonnull stop) {
for (NSUInteger i = range.location; i < NSMaxRange(range); i++) {
NSUInteger newIndex = block(i);
Expand All @@ -38,7 +38,7 @@ - (NSIndexSet *)as_indexesByMapping:(NSUInteger (^)(NSUInteger))block

- (NSIndexSet *)as_intersectionWithIndexes:(NSIndexSet *)indexes
{
NSMutableIndexSet *result = [NSMutableIndexSet indexSet];
NSMutableIndexSet *result = [[NSMutableIndexSet alloc] init];
[self enumerateRangesUsingBlock:^(NSRange range, BOOL * _Nonnull stop) {
[indexes enumerateRangesInRange:range options:kNilOptions usingBlock:^(NSRange range, BOOL * _Nonnull stop) {
[result addIndexesInRange:range];
Expand All @@ -49,7 +49,7 @@ - (NSIndexSet *)as_intersectionWithIndexes:(NSIndexSet *)indexes

+ (NSIndexSet *)as_indexSetFromIndexPaths:(NSArray<NSIndexPath *> *)indexPaths inSection:(NSUInteger)section
{
NSMutableIndexSet *result = [NSMutableIndexSet indexSet];
NSMutableIndexSet *result = [[NSMutableIndexSet alloc] init];
for (NSIndexPath *indexPath in indexPaths) {
if (indexPath.section == section) {
[result addIndex:indexPath.item];
Expand Down Expand Up @@ -89,22 +89,11 @@ - (NSString *)as_smallDescription

+ (NSIndexSet *)as_sectionsFromIndexPaths:(NSArray<NSIndexPath *> *)indexPaths
{
NSMutableIndexSet *result = [NSMutableIndexSet indexSet];
NSMutableIndexSet *result = [[NSMutableIndexSet alloc] init];
for (NSIndexPath *indexPath in indexPaths) {
[result addIndex:indexPath.section];
}
return result;
}

- (NSArray<NSIndexPath *> *)as_filterIndexPathsBySection:(id<NSFastEnumeration>)indexPaths
{
NSMutableArray *result = [NSMutableArray array];
for (NSIndexPath *indexPath in indexPaths) {
if ([self containsIndex:indexPath.section]) {
[result addObject:indexPath];
}
}
return result;
}
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unused


@end
6 changes: 3 additions & 3 deletions Source/Details/_ASDisplayViewAccessiblity.mm
Original file line number Diff line number Diff line change
Expand Up @@ -142,8 +142,8 @@ static void CollectUIAccessibilityElementsForNode(ASDisplayNode *node, ASDisplay
static void CollectAccessibilityElementsForContainer(ASDisplayNode *container, _ASDisplayView *view, NSMutableArray *elements) {
UIAccessibilityElement *accessiblityElement = [ASAccessibilityElement accessibilityElementWithContainer:view node:container containerNode:container];

NSMutableArray<ASAccessibilityElement *> *labeledNodes = [NSMutableArray array];
NSMutableArray<ASAccessibilityCustomAction *> *actions = [NSMutableArray array];
NSMutableArray<ASAccessibilityElement *> *labeledNodes = [[NSMutableArray alloc] init];
NSMutableArray<ASAccessibilityCustomAction *> *actions = [[NSMutableArray alloc] init];
std::queue<ASDisplayNode *> queue;
queue.push(container);

Expand Down Expand Up @@ -268,7 +268,7 @@ - (NSArray *)accessibleElements
return _accessibleElements;
}

NSMutableArray *accessibleElements = [NSMutableArray array];
NSMutableArray *accessibleElements = [[NSMutableArray alloc] init];
CollectAccessibilityElementsForView(self, accessibleElements);
SortAccessibilityElements(accessibleElements);
_accessibleElements = accessibleElements;
Expand Down
4 changes: 2 additions & 2 deletions Source/Layout/ASLayout.mm
Original file line number Diff line number Diff line change
Expand Up @@ -236,10 +236,10 @@ - (ASLayout *)filteredNodeLayoutTree NS_RETURNS_RETAINED
queue.push_back({sublayout, sublayout.position});
}

NSMutableArray *flattenedSublayouts = [NSMutableArray array];
NSMutableArray *flattenedSublayouts = [[NSMutableArray alloc] init];

while (!queue.empty()) {
const Context context = queue.front();
const Context context = std::move(queue.front());
queue.pop_front();

ASLayout *layout = context.layout;
Expand Down
2 changes: 1 addition & 1 deletion Source/Layout/ASStackLayoutSpec.mm
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ - (ASLayout *)calculateLayoutThatFits:(ASSizeRange)constrainedSize
self.style.descender = stackChildren.back().style.descender;
}

NSMutableArray *sublayouts = [NSMutableArray array];
auto sublayouts = [[NSMutableArray<ASLayout *> alloc] init];
for (const auto &item : positionedLayout.items) {
[sublayouts addObject:item.layout];
}
Expand Down
2 changes: 1 addition & 1 deletion Source/Private/ASDisplayNode+AsyncDisplay.mm
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ - (asyncdisplaykit_async_transaction_operation_block_t)_displayBlockWithAsynchro

if (shouldBeginRasterizing) {
// Collect displayBlocks for all descendants.
NSMutableArray *displayBlocks = [NSMutableArray array];
NSMutableArray *displayBlocks = [[NSMutableArray alloc] init];
[self _recursivelyRasterizeSelfAndSublayersWithIsCancelledBlock:isCancelledBlock displayBlocks:displayBlocks];
CHECK_CANCELLED_AND_RETURN_NIL();

Expand Down
Loading