摘要
内存的泄漏与溢出是在进行Android开发时最常见且棘手的问题之一。为了提高Android开发的质量和效率,总结了Android的内存泄漏与溢出的常见类型和解决方法。内存泄漏的常见类型有集合类泄漏、传入Activity的Context造成的内存泄漏、非静态内部类创建静态实例和线程造成的内存泄漏等;内存溢出的常见类型有由强引用造成的内存溢出、由大量图片显示导致的内存溢出、从数据库中取出大量数据造成的内存溢出、代码中存在死循环或循环产生过多重复对象实体造成的内存溢出等,并提出了由图片造成的内存溢出的新的解决方法。
Memory leak and out of memory is one of the commonest and most difficult question when developing applications for android.To improve its qualityand efficiency,discuss about memory leak and out of memory of android is essential.The common reason for memory leak,for example,are collections-class leaks,leaks that are caused by incomimg activity’s context,non static internal classes create static instances and memory leaks caused by threads and so on.The common types that cause out of memory are strong references,large numbers of pictures,and large amounts of data from the database.There are dead loops or loops in the code that produce too many duplicate object entities,and put forward a new view to solve out of memory caused by plenty of pictures.
出处
《软件导刊》
2018年第2期50-52,共3页
Software Guide
基金
南昌航空大学第十一届"三小"项目(2016YBXG023)