Skip to content

Commit a39d6c3

Browse files
author
“saiHemak”
committed
Performance regression in NSMutableData[SR-3966]
1 parent 0cbb322 commit a39d6c3

File tree

1 file changed

+4
-1
lines changed
  • CoreFoundation/Collections.subproj

1 file changed

+4
-1
lines changed

CoreFoundation/Collections.subproj/CFData.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -312,10 +312,13 @@ CFTypeID CFDataGetTypeID(void) {
312312
void _CFDataInit(CFMutableDataRef memory, CFOptionFlags flags, CFIndex capacity, const uint8_t *bytes, CFIndex length, Boolean noCopy) {
313313
Boolean isMutable = ((flags & __kCFMutable) != 0);
314314
Boolean isGrowable = ((flags & __kCFGrowable) != 0);
315+
Boolean isDontDeallocate = ((flags & __kCFDontDeallocate) != 0);
315316

316317
__CFDataSetNumBytesUsed(memory, 0);
317318
__CFDataSetLength(memory, 0);
318-
__CFDataSetInfoBits(memory, __kCFDontDeallocate);
319+
if (isDontDeallocate) {
320+
__CFDataSetInfoBits(memory, __kCFDontDeallocate);
321+
}
319322

320323
if (isMutable && isGrowable) {
321324
__CFDataSetCapacity(memory, __CFDataRoundUpCapacity(1));

0 commit comments

Comments
 (0)