Thursday, June 9, 2011

[android-developers] Re: Delete a variable

The usual problem on Android and other phones is not the program heap
but rather the heap (often separate) used for images. In particular
on Android this is a problem that requires some special programming
techniques if you're using a lot of images.

In Java, local variables "go out of scope" when you return from the
method where they're declared. However, with some GC schemes there's
a slight chance that a variable could have "life after death" when a
new method is called that uses the same stack space, but the specific
location of the variable isn't overwritten. (I don't think this is a
problem on Android, as it has a "precise" garbage collector.)

On Jun 9, 6:04 am, New Developer <secur...@isscp.com> wrote:
> Thanks to both
> but that is another side of my question,  when do the variables go out of scope ?
>
> thanks again
>
> On Jun 9, 2011, at 2:47 AM, Simon Platten wrote:
>
> > Java may not garbage collect until resources are low and it knows that an object is no longer in use.  Make sure that you assign your object to null or ensure it goes out of scope then java wilĺ treat it as no longer referenced.
> > Regards,Sy
>
> >> On 9 Jun 2011 04:11, "TreKing" <treking...@gmail.com> wrote:
>
> >> On Wed, Jun 8, 2011 at 9:05 PM, New Developer <secur...@isscp.com> wrote:
>
> >> > Bitmap  pictBM = Bitma...
>
> >> Don't hard code the SD card path - that's not portable.
>
> >> > In c++ there is  .free()  or  .destroy()  call
> >> > What do you use in android ?
>
> >> Start here:http://developer.android.com/reference/android/graphics/Bitmap.html#r...()
>
> >> -------------------------------------------------------------------------------------------------
> >> TreKing - Chicago transit tracking app for Android-powered devices
>
> >> --
> >> You received this message because you are subscribed to the Google
> >> Groups "Android Developers"...
>
> > --
> > You received this message because you are subscribed to the Google
> > Groups "Android Developers" group.
> > To post to this group, send email to android-developers@googlegroups.com
> > To unsubscribe from this group, send email to
> > android-developers+unsubscribe@googlegroups.com
> > For more options, visit this group at
> >http://groups.google.com/group/android-developers?hl=en

--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

No comments:

Post a Comment