File tree Expand file tree Collapse file tree 1 file changed +2
-2
lines changed Expand file tree Collapse file tree 1 file changed +2
-2
lines changed Original file line number Diff line number Diff line change @@ -24,14 +24,14 @@ pub fn leak(str: &str) {
24
24
INSString.as_str() internaly uses UTF8String property of NSString.
25
25
[ Apple doc] ( https://developer.apple.com/documentation/foundation/nsstring/1411189-utf8string?language=objc )
26
26
says that the memory behind this pointer has a lifetime shorter than a lifetime of an NSString itself.
27
- But apparently, this is not entirely true. At least, this statement is not valid from strings that contain
27
+ But apparently, this is not entirely true. At least, this statement is not valid for strings that contain
28
28
characters outside the ASCI range. And sometimes for strings that do not.
29
29
30
30
Sadly, I did not find any reason for that.
31
31
32
32
So in the end, the actual leak occurs not in INSString.as_str() but, I guess, in objc runtime.
33
33
34
- ## Is there a warkaround ?
34
+ ## Is there a workaround ?
35
35
36
36
Yes. NSString::getCString ([ Apple doc] ( https://developer.apple.com/documentation/foundation/nsstring/1415702-getcstring ) ) and we can use it like this:
37
37
You can’t perform that action at this time.
0 commit comments