开发者

Android memory problem

Hi

I have to upload different files (Images, Videos and Audio). But t开发者_如何学运维he system is crashing due to low memory.

I have a lot of controls and each have different listeners. Please point me the best way i need to go so that i use the memory efficiently.

When i checked using DDMS eclipse, the memory is creeping from screen to screen. And when i upload once that memory is not removing. I have stored every files in sdcard and at the time of upload this using

FileBody bin = new FileBody(new File (path/filename) ,Fileformat); 

I think the memory used here are also unallocated. I have declared this in a local function scope hoping the GC will manage this when the scope is gone. But it is not happening for me.

Please help me, What i need to do here? Is there any way to explicitly call GC on some objects? How to remove object data object? From DDMS eclipse, i got it is data object which is using main portion of my memory. Which all come under this?

Thanks


Have you tried using the org.apache.http.entity.FileEntity to create a http post entity? The content of this http entity will be streamed from the given file automatically with streamlined memory and cpu consumption.


Try too implement streaming wherever you can. You can also tip the garbage collector by nulling objects you don't need any more, and/or calling System.gc()

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜