Hello there,
We have been talking about a known memory leak in String.cString(using: encoding) and String.utf8String over a JIRA report and a closed PR 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().
Thanks to Tony and Philippe for their comments.
The options we are left with are:
-
See Philippe’s suggestion here - implement an NSData backing and the needed autorelease() simulation on Linux.
-
What Tony suggests here - "eliding these methods from NSString and implementing them differently in String"
Does anyone else have other approaches to solve this problem?
I am curious about how we will go ahead here and wanted to make sure there is a consensus.
Thanks for your time!
Pushkar N Kulkarni,
IBM Runtimes
Simplicity is prerequisite for reliability - Edsger W. Dijkstra