<font face="Verdana,Arial,Helvetica,sans-serif" size="2"><br><font face="Verdana,Arial,Helvetica,sans-serif" size="2"><font><font><div class="socmaildefaultfont" dir="ltr"><div class="socmaildefaultfont" dir="ltr"><div class="socmaildefaultfont" dir="ltr"><div dir="ltr" style="font-style: normal;"><div dir="ltr">Hello there, &nbsp;</div><div dir="ltr"><br></div><div dir="ltr">We have been talking about a known memory leak in String.cString(using: encoding) and String.utf8String over a <a target="_blank" href="https://bugs.swift.org/browse/SR-4036" title="https://bugs.swift.org/browse/SR-4036">JIRA report</a>&nbsp;and a <a target="_blank" href="https://github.com/apple/swift-corelibs-foundation/pull/891" title="https://github.com/apple/swift-corelibs-foundation/pull/891">closed PR</a>&nbsp;where we considered the option of &nbsp;freeing up the memory allocated by NSString.cString() in String.cString() - this approach isn’t acceptable because it leaves the leak unresolved with NSString.cString(). &nbsp;</div><div dir="ltr"><br></div><div dir="ltr">Thanks to Tony and Philippe for their comments.&nbsp;</div><div dir="ltr"><br></div><div dir="ltr">The options we are left with are:</div><div dir="ltr">1. See Philippe’s suggestion&nbsp;<a target="_blank" href="https://bugs.swift.org/browse/SR-4036?focusedCommentId=22165&amp;page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-22165" title="https://bugs.swift.org/browse/SR-4036?focusedCommentId=22165&amp;page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-22165">here</a>&nbsp;- implement an NSData backing and the needed autorelease() simulation on Linux.</div><div dir="ltr">2. What Tony suggests <a target="_blank" href="https://bugs.swift.org/browse/SR-4036?focusedCommentId=22150&amp;page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-22150" title="https://bugs.swift.org/browse/SR-4036?focusedCommentId=22150&amp;page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-22150">here</a> - "eliding these methods from NSString and implementing them differently in String"<br></div><div dir="ltr"><br></div><div dir="ltr">Does anyone else have other approaches to solve this problem?&nbsp;</div><div dir="ltr"><br></div><div dir="ltr">I am curious about how we will go ahead here and wanted to make sure there is a consensus. &nbsp;</div><div dir="ltr"><br></div><div dir="ltr">Thanks for your time!</div><div dir="ltr"><br></div><font face="Sans Serif, Verdana, Arial, Helvetica, sans-serif">Pushkar N Kulkarni,</font></div>
<div dir="ltr" style="font-style: normal;"><font face="Sans Serif, Verdana, Arial, Helvetica, sans-serif">IBM Runtimes</font></div><div dir="ltr" style="font-style: normal;"><font face="Sans Serif, Verdana, Arial, Helvetica, sans-serif"><br></font></div><div dir="ltr"><font face="serif, Times New Roman, Times, serif"><i>Simplicity is prerequisite for reliability - Edsger W. Dijkstra</i></font></div>
<div dir="ltr" style="font-style: normal; font-size: 10.5pt; font-family: Arial;"><br></div></div></div></div></font></font></font></font><BR>