Skip to content

[SR-6962] NSMutableData leak on Linux with Swift 4.1 #4258

Closed
@swift-ci

Description

@swift-ci
Previous ID SR-6962
Radar None
Original Reporter djones6 (JIRA User)
Type Bug
Status Closed
Resolution Done
Environment

Ubuntu 14.04, Swift 4.1-DEVELOPMENT-SNAPSHOT-2018-02-01-a

Additional Detail from JIRA
Votes 0
Component/s Foundation
Labels Bug, Leak
Assignee mamabusi (JIRA)
Priority Medium

md5: 9965209baa675bd606956e1c2c7be64c

Issue Description:

When rrunning Kitura on recent 4.1 and master snapshots, I observe a memory leak on calls to NSMutableData.append().

I would guess that this is related to the same set of changes as SR-6849, but I have not attempted to prove that. Extract from a valgrind massif report:

93.39% (7,852,969B) (heap allocation functions) malloc/new/new[], --alloc-fns, etc.
->69.76% (5,866,048B) 0x552B7FF: __CFSafelyReallocate (CFBase.c:771)
| ->69.76% (5,866,048B) 0x55589FA: __CFDataGrow (CFData.c:554)
|   ->69.76% (5,866,048B) 0x5556F41: CFDataReplaceBytes (CFData.c:639)
|     ->69.76% (5,866,048B) 0x5558C1D: CFDataAppendBytes (CFData.c:609)
|       ->69.76% (5,866,048B) 0x580576B: Foundation.NSMutableData.append(Swift.UnsafeRawPointer, length: Swift.Int) -> () (NSData.swift:1059)
|         ->69.56% (5,849,088B) 0x241742: KituraNet.HTTPServerResponse.(writeToSocketThroughBuffer in _8A9E8F62631F03CCFCED4F4223E40C30)(text: Swift.String) throws -> () (HTTPServerResponse.swift:204)
...etc

KituraNet code here is: https://github.com/IBM-Swift/Kitura-net/blob/2.0.1/Sources/KituraNet/HTTP/HTTPServerResponse.swift#L204

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions