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.
当我写
char *s = "hello everyone"; s++;
这里有内存泄漏吗?
p/s:英语不是我的母语,所以可能会有一些错误。
不,没有分配字符串文字,因此没有内存泄漏。
不,那里没有泄漏,它与指向字符串文字的指针无关。增加指针永远不会导致内存泄漏。导致内存泄漏的唯一原因是没有释放您分配的内存。
I wanna build a Class to parse List<T> to/from String using Gson:
List<T>
String
private static class ListParser<T> { Gson gson = new Gson();