正确的Andr​​oid清理/处理 [英] Android proper clean up/disposing

查看:158
本文介绍了正确的Andr​​oid清理/处理的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有一种方法来清理对象和其他变量创建?或者,它们会自动处理或我有这个整体概念错了吗?什么是正确的方式去这样做?我想,以避免GC尽可能。

Is there a way to "clean up" objects and other variables you create? Or are they automatically disposed of or do I have this whole concept wrong? What is the proper way to go about doing this? I am trying to avoid the GC as much as possible.

推荐答案

在GC的语言,没有内存管理清理的唯一方法就是GC。您可以强制GC,但它不是建议,在GC pretty的好,要更加积极主动的对象集为空为GC来清理。

The only way to cleanup in an GC language with no memory management is the GC . You can force GC but its not recommended , the GC is pretty good , to be more proactive set objects to null for the GC to clean up.

增加:

也尽量使物体的地方越好,这样他们GCed,因为他们的范围了。

Also try to make objects as local as possible , that way they are GCed as they scope out.

这篇关于正确的Andr​​oid清理/处理的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆