- 论坛徽章:
- 2
|
本帖最后由 lhd666 于 2017-10-20 18:02 编辑
- #include <glib.h>
- int main(int argc, char **argv)
- {
- GList *list = NULL;
- list = g_list_append(list, "one");
- list = g_list_append(list, "two");
- list = g_list_append(list, "three");
- GList *l = list;
- while (l != NULL) {
- GList *next = l->next;
- list = g_list_delete_link(list, l);
- l = next;
- }
- return 0;
- }
复制代码
使用valgrind测试显示"still reachable: 18,604 bytes in 6 blocks"
我对valgrind不熟悉,网上查资料,结果莫衷一是,有的说不是内存泄漏,不用在意,有的说长期运行可能会耗尽内存。想请教下大家,是有哪里的内存没有释放掉吗?
试了试GPtrArray,也存在类似的情况。
|
|