Keep a reference on the object somewhere in your app as long as you need to
hold the wake lock.  You need to do that, anyway, so you can release the
wake lock at the appropriate time.

On Sat, Aug 29, 2009 at 7:37 PM, flohier <[email protected]> wrote:

>
> Dear All,
>
> I'm acquiring a wake lock and apparently, it gets garbage collected in
> my app at some point with the following error;
>
> D/dalvikvm( 3554): GC freed 6047 objects / 487704 bytes in 198ms
> E/AndroidRuntime( 3554): java.lang.Exception: WakeLock finalized while
> still held: AMBU
> E/AndroidRuntime( 3554):        at android.os.PowerManager
> $WakeLock.finalize(PowerManager.java:295)
> E/AndroidRuntime( 3554):        at dalvik.system.NativeStart.run
> (Native Method)
> I/Process (   58): Sending signal. PID: 3554 SIG: 3
> I/dalvikvm( 3554): threadid=7: reacting to signal 3
>
> What is the recommended approach to overwrite the finalize to force
> releasing the lock or -better- force the GC not to release the lock ?
>
> Thanks,
>
>
> >
>


-- 
Dianne Hackborn
Android framework engineer
[email protected]

Note: please don't send private questions to me, as I don't have time to
provide private support, and so won't reply to such e-mails.  All such
questions should be posted on public forums, where I and others can see and
answer them.

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

Reply via email to