位图内存泄漏位图、内存

2023-09-05 23:15:51 作者:快到我怀里来!

所以,蜂窝状前,位图obeject只是一个指针的本机堆  内存空间(用malloc),我可以清理一下本机内存调用.recycle();蜂巢后的位图的内存分配的应用程序堆,它得到GC电话。

So, before honeycomb, the Bitmap obeject was just a pointer for a native heap memory space( using malloc ), and i could clean that native memory calling .recycle() ; after honeycomb the memory for the Bitmap is allocated in the app heap, which gets gc calls.

我的问题是,我的应用程序需要支持2.2+所以我应该怎么办?检查版本,并呼吁recyle?不要调用循环呢?什么是你对他的意见。因为我有举办一些位图实例的BitmapCache,我不希望他们活在记忆,直到永远。

My question is, my app need to support 2.2+ so what should I do? Check the version and call recyle? Dont call recycle at all? What is your advice for that. Because i have a BitmapCache which hold some Bitmap instances and i dont want them living in the memory for ever.

推荐答案

在任何android版无论是升级Froyo,姜饼和蜂窝。你必须检查自己的内存管理。是的,从2.2+可以调整从SD卡,你的应用程序,但保持的位图堆内存,始终将创建问题无论您使用任一版本。如果你想使用纯位图,那么你为什么不按照他们的方式,尝试此链接。他们已经给了你许多方法来有效地管理位图。请点击此链接: 显示位图有效

In any android version whether it is froyo,gingerbread or honeycomb. You have to check yourself for memory management. Yes, from 2.2+ you can adjust you application from sdcard, but keeping the bitmaps in heap memory, always will create problem for whether you use either version. If you want pure using of bitmaps, then why dont you follow their way, try this link. They have given you many ways to managing the bitmaps efficiently. Follow this link: Displaying bitmaps efficiently