Android Static Variable Scope and Lifetime

Posted by Edison on Stack Overflow See other posts from Stack Overflow or by Edison
Published on 2011-03-14T23:49:03Z Indexed on 2011/03/15 0:10 UTC
Read the original article Hit count: 157

I have an application that has a Service uses a ArrayList to store in the background for a very long time, the variable is initialized when the service started. The service is in the background and there will be frequent access to the variable (that's why i don't want to use file management or settings since it will be very expensive for a file I/O for the sake of battery life). The variable will likely to be ~1MB->2MB over its life tie. Is it safe to say that it will never be nulled by GC or the system or is there any way to prevent it? Thanks.

© Stack Overflow or respective owner

Related posts about android

Related posts about memory-management