[android-developers] Re: Out of memory exception on setting wallpaper
Hi , Thanks for the help . The problem is resolved . I had used a ContentResolver for listening to contacts updated and dint unregister them in the onDestroy() method . Now have included the code changes and it seems to work fine . Im still in a doubt if this was the real problem for the out of memory exception. Any comments are welcome . Thanks and Regards, Navin On Mar 12, 9:26 pm, Romain Guy romain...@google.com wrote: getWallpaper() is not leaking. The default Home app is using it and does not experience out of memory errors because of that. I am more than willing to fix any existing memory leak in the framework (and I did several times) or in the default apps (and I did several times) but developers should really stop assuming that out of memory errors are always caused by the framework. It is *very* easy for an application to leak or simply to use too much memory. On Thu, Mar 12, 2009 at 7:24 AM, JP joachim.pfeif...@gmail.com wrote: Sounds like the Drawable remains attached to a View between rotations. See blog post: http://android-developers.blogspot.com/2009/01/avoiding-memory-leaks On Mar 12, 3:29 am, ursnavin ursna...@gmail.com wrote: Hi , Im trying to develop a home application . Whenever there is a shift between landscape and potrait mode , im setting thewallpaperonCreate () function using the below code . getWindow().setBackgroundDrawable(getwallpaper()); The code seems to work fine for first few shifts , but after that I run into an out of memory exception . Is this the correct approach or am i missing some thing here . Below is the exception that i get . 03-12 15:08:55.118: ERROR/AndroidRuntime(739): java.lang.OutOfMemoryError: bitmap size exceeds VM budget Thanks Navin -- Romain Guy Android framework engineer romain...@android.com Note: please don't send private questions to me, as I don't have time to provide private support. 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 android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: Out of memory exception on setting wallpaper
ursnavin wrote: Hi , Im trying to develop a home application . Whenever there is a shift between landscape and potrait mode , im setting the wallpaper onCreate () function using the below code . getWindow().setBackgroundDrawable(getwallpaper()); The code seems to work fine for first few shifts , but after that I run into an out of memory exception . Is this the correct approach or am i missing some thing here . Below is the exception that i get . 03-12 15:08:55.118: ERROR/AndroidRuntime(739): java.lang.OutOfMemoryError: bitmap size exceeds VM budget Sounds like a memory leak. Are you sure getWallpaper() isn't doing something that would hold references to past bitmaps, causing them not to get garbage collected? -- Mark Murphy (a Commons Guy) http://commonsware.com Android Training in Sweden -- http://www.sotrium.com/training.php --~--~-~--~~~---~--~~ 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-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: Out of memory exception on setting wallpaper
Hey, the getWallpaper() is the frameworks getWallpaper() function.Everytime the xception occurs only inside this function.Is this a bug in android?? On Mar 12, 3:56 pm, Mark Murphy mmur...@commonsware.com wrote: ursnavin wrote: Hi , Im trying to develop a home application . Whenever there is a shift between landscape and potrait mode , im setting the wallpaper onCreate () function using the below code . getWindow().setBackgroundDrawable(getwallpaper()); The code seems to work fine for first few shifts , but after that I run into anoutofmemoryexception . Is this the correct approach or am i missing some thing here . Below is the exception that i get . 03-12 15:08:55.118: ERROR/AndroidRuntime(739): java.lang.OutOfMemoryError: bitmap size exceeds VM budget Sounds like amemoryleak. Are you sure getWallpaper() isn't doing something that would hold references to past bitmaps, causing them not to get garbage collected? -- Mark Murphy (a Commons Guy)http://commonsware.com Android Training in Sweden --http://www.sotrium.com/training.php --~--~-~--~~~---~--~~ 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-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: Out of memory exception on setting wallpaper
Hey, Thanks for the reply, The getWallpaper() is the android frameworks getWallpaper() function. On Mar 12, 3:56 pm, Mark Murphy mmur...@commonsware.com wrote: ursnavin wrote: Hi , Im trying to develop a home application . Whenever there is a shift between landscape and potrait mode , im setting the wallpaper onCreate () function using the below code . getWindow().setBackgroundDrawable(getwallpaper()); The code seems to work fine for first few shifts , but after that I run into an out of memory exception . Is this the correct approach or am i missing some thing here . Below is the exception that i get . 03-12 15:08:55.118: ERROR/AndroidRuntime(739): java.lang.OutOfMemoryError: bitmap size exceeds VM budget Sounds like a memory leak. Are you sure getWallpaper() isn't doing something that would hold references to past bitmaps, causing them not to get garbage collected? -- Mark Murphy (a Commons Guy)http://commonsware.com Android Training in Sweden --http://www.sotrium.com/training.php --~--~-~--~~~---~--~~ 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-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: Out of memory exception on setting wallpaper
ursnavin wrote: Hey, Thanks for the reply, The getWallpaper() is the android frameworks getWallpaper() function. Oh. I don't know what to tell you, then. -- Mark Murphy (a Commons Guy) http://commonsware.com Android Training in Sweden -- http://www.sotrium.com/training.php --~--~-~--~~~---~--~~ 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-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: Out of memory exception on setting wallpaper
Sounds like the Drawable remains attached to a View between rotations. See blog post: http://android-developers.blogspot.com/2009/01/avoiding-memory-leaks.html On Mar 12, 3:29 am, ursnavin ursna...@gmail.com wrote: Hi , Im trying to develop a home application . Whenever there is a shift between landscape and potrait mode , im setting the wallpaper onCreate () function using the below code . getWindow().setBackgroundDrawable(getwallpaper()); The code seems to work fine for first few shifts , but after that I run into an out of memory exception . Is this the correct approach or am i missing some thing here . Below is the exception that i get . 03-12 15:08:55.118: ERROR/AndroidRuntime(739): java.lang.OutOfMemoryError: bitmap size exceeds VM budget Thanks Navin --~--~-~--~~~---~--~~ 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-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: Out of memory exception on setting wallpaper
getWallpaper() is not leaking. The default Home app is using it and does not experience out of memory errors because of that. I am more than willing to fix any existing memory leak in the framework (and I did several times) or in the default apps (and I did several times) but developers should really stop assuming that out of memory errors are always caused by the framework. It is *very* easy for an application to leak or simply to use too much memory. On Thu, Mar 12, 2009 at 7:24 AM, JP joachim.pfeif...@gmail.com wrote: Sounds like the Drawable remains attached to a View between rotations. See blog post: http://android-developers.blogspot.com/2009/01/avoiding-memory-leaks.html On Mar 12, 3:29 am, ursnavin ursna...@gmail.com wrote: Hi , Im trying to develop a home application . Whenever there is a shift between landscape and potrait mode , im setting the wallpaper onCreate () function using the below code . getWindow().setBackgroundDrawable(getwallpaper()); The code seems to work fine for first few shifts , but after that I run into an out of memory exception . Is this the correct approach or am i missing some thing here . Below is the exception that i get . 03-12 15:08:55.118: ERROR/AndroidRuntime(739): java.lang.OutOfMemoryError: bitmap size exceeds VM budget Thanks Navin -- Romain Guy Android framework engineer romain...@android.com Note: please don't send private questions to me, as I don't have time to provide private support. 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 android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---