Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
在 iPhone SDK 中:
NSString * abc= @"123"; NSString *temp=abc;
在安卓中:
String abc ="123"; String temp=abc;
在这种情况下,哪一个使用更多的内存?
没有办法说 - 这是两种不同的语言,运行在完全不同的操作系统和硬件上。Objective-C 被编译为本机代码,而 Android 的 Java 被编译为字节码,然后在运行时进行解释。
但是,由于字符串是两种语言的内置构造,因此极有可能在这两种语言上都非常有效。基本上,您不必担心在移动应用程序中处理字符串的内存效率——还有更紧迫的问题!