<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, </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> 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> where we considered the option of 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(). </div><div dir="ltr"><br></div><div dir="ltr">Thanks to Tony and Philippe for their comments. </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 <a target="_blank" href="https://bugs.swift.org/browse/SR-4036?focusedCommentId=22165&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-22165" title="https://bugs.swift.org/browse/SR-4036?focusedCommentId=22165&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-22165">here</a> - 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&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-22150" title="https://bugs.swift.org/browse/SR-4036?focusedCommentId=22150&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? </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. </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>