java.lang.OutOfMemoryError: bitmap size exceeds VM budget

by Matt Kanninen » Thu, 26 Nov 2009 01:37:20 GMT


Sponsored Links
 This:
        private static final int[] glowDrawableIds={
                R.drawable.graphic_microphoneglow_01,
                R.drawable.graphic_microphoneglow_02,
                R.drawable.graphic_microphoneglow_03,
                R.drawable.graphic_microphoneglow_04,
                R.drawable.graphic_microphoneglow_05,
                R.drawable.graphic_microphoneglow_06,
                R.drawable.graphic_microphoneglow_07,
                R.drawable.graphic_microphoneglow_08,
                R.drawable.graphic_microphoneglow_09,
                R.drawable.graphic_microphoneglow_10
        };
...
View glow = findViewById(R.id.glow);
..

glow.setBackgroundResource(glowDrawableIds[scale]);

is causing

11-25 09:21:02.046: WARN/UsageStats(1018): Failed to persist new stats
11-25 09:21:02.694: DEBUG/dalvikvm(2386): GC freed 298 objects / 15656
bytes in 61ms
11-25 09:21:02.952: ERROR/dalvikvm-heap(2386): 1111680-byte external
allocation too large for this process.
11-25 09:21:02.952: ERROR/(2386): VM won't let us allocate 1111680
bytes
11-25 09:21:02.952: DEBUG/AndroidRuntime(2386): Shutting down VM
11-25 09:21:02.952: WARN/dalvikvm(2386): threadid=3: thread exiting
with uncaught exception (group=0x4001b180)
11-25 09:21:02.952: ERROR/AndroidRuntime(2386): Uncaught handler:
thread main exiting due to uncaught exception
11-25 09:21:03.014: ERROR/AndroidRuntime(2386):
java.lang.OutOfMemoryError: bitmap size exceeds VM budget
11-25 09:21:03.014: ERROR/AndroidRuntime(2386):     at
android.graphics.Bitmap.nativeCreate(Native Method)
11-25 09:21:03.014: ERROR/AndroidRuntime(2386):     at
android.graphics.Bitmap.createBitmap(Bitmap.java:468)
11-25 09:21:03.014: ERROR/AndroidRuntime(2386):     at
android.graphics.Bitmap.createBitmap(Bitmap.java:435)
11-25 09:21:03.014: ERROR/AndroidRuntime(2386):     at
android.graphics.Bitmap.createScaledBitmap(Bitmap.java:340)
11-25 09:21:03.014: ERROR/AndroidRuntime(2386):     at
android.graphics.BitmapFactory.finishDecode(BitmapFactory.java:488)
11-25 09:21:03.014: ERROR/AndroidRuntime(2386):     at
android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:462)
11-25 09:21:03.014: ERROR/AndroidRuntime(2386):     at
android.graphics.BitmapFactory.decodeResourceStream(BitmapFactory.java:
323)
11-25 09:21:03.014: ERROR/AndroidRuntime(2386):     at
android.graphics.drawable.Drawable.createFromResourceStream
(Drawable.java:697)
11-25 09:21:03.014: ERROR/AndroidRuntime(2386):     at
android.content.res.Resources.loadDrawable(Resources.java:1705)
11-25 09:21:03.014: ERROR/AndroidRuntime(2386):     at
android.content.res.Resources.getDrawable(Resources.java:580)
11-25 09:21:03.014: ERROR/AndroidRuntime(2386):     at
android.view.View.setBackgroundResource(View.java:7187)

--



java.lang.OutOfMemoryError: bitmap size exceeds VM budget

by Amit » Thu, 17 Jun 2010 15:08:00 GMT


 Hi

java.lang.OutOfMemoryError: bitmap size exceeds VM budget
I am getting this message in my log. As I investigated and found out
while loading contact image this error comes.I checked  size of the
image file and it was normal so came to a conclusion that other
processes filling up the memory and hence at the time this image is
being loaded ,VM running low of memory.

My question is that, is there any tool to figure out which process is
responsible for occupying memory so that we can look into the process
for the exact reason.

Thanks,
Amit

--


Sponsored Links


Other Threads

1. Porting Wifi driver on Android

Hi everyone,
    I'm porting wifi driver (Ralink chip) on Android 2.0.1 board.
first of all I made some modifies

(1)   modify build/target/board/generic/BoardConfig.mk

add HAVE_CUSTOM_WIFI_DRIVER_2 := true



(2)   Android using wpa_supplicant to management wifi. Make sure
external/wpa_supplicant/.config is looking like this

# CONFIG_NO_WPA=y

CONFIG_OS=unix

CONFIG_IEEE8021X_EAPOL=y

CONFIG_EAP_MD5=y

CONFIG_EAP_MSCHAPV2=y

CONFIG_EAP_TLS=y

CONFIG_EAP_PEAP=y

CONFIG_EAP_TTLS=y

CONFIG_EAP_GTC=y

CONFIG_EAP_OTP=y

CONFIG_EAP_SIM=y

CONFIG_EAP_AKA=y

CONFIG_EAP_PSK=y

CONFIG_EAP_SAKE=y

CONFIG_EAP_GPSK=y

CONFIG_EAP_PAX=y

CONFIG_EAP_LEAP=y

# CONFIG_EAP_FAST=y

CONFIG_PKCS12=y

# CONFIG_PCSC=y

CONFIG_SMARTCARD=y

CONFIG_WIRELESS_EXTENSION=y

CONFIG_CTRL_IFACE=y

# CONFIG_DRIVER_HOSTAP=y

# CONFIG_DRIVER_HERMES=y

# CONFIG_DRIVER_MADWIFI=y

# CONFIG_DRIVER_ATMEL=y

CONFIG_DRIVER_WEXT=y

# CONFIG_DRIVER_NDISWRAPPER=y

# CONFIG_DRIVER_BROADCOM=y

# CONFIG_DRIVER_IPW=y

# CONFIG_DRIVER_BSD=y

# CONFIG_DRIVER_NDIS=y

# CONFIG_DRIVER_TEST=y

# CONFIG_DRIVER_CUSTOM=y

# CONFIG_DEBUG_FILE=y

# CONFIG_INTERNAL_LIBTOMMATH=y



(3)   Enable wpa_supplicant compile option, modify external/
wpa_supplicant/Android.mk

(3.1)

LOCAL_PATH := $(call my-dir)



WPA_BUILD_SUPPLICANT := true

ifneq ($(TARGET_SIMULATOR),true)

  ifneq ($(BOARD_WPA_SUPPLICANT_DRIVER),)

    WPA_BUILD_SUPPLICANT := true

    CONFIG_DRIVER_$(BOARD_WPA_SUPPLICANT_DRIVER) = y

  endif



(3.2) remove mark symbol, and look like this

########################


local_target_dir := $(TARGET_OUT)/etc/wifi



include $(CLEAR_VARS)

LOCAL_MODULE := wpa_supplicant.conf

LOCAL_MODULE_TAGS := user

LOCAL_MODULE_CLASS := ETC

LOCAL_MODULE_PATH := $(local_target_dir)

LOCAL_SRC_FILES := $(LOCAL_MODULE)

include $(BUILD_PREBUILT)

#

########################



(4)   Modify wpa_supplicant setting file, and out/target/product/
generic/system/etc/wifi/ will be created after #make in step (3) out/
target/product/generic/system/etc/wifi/wpa_supplicant.conf



(4.1)

# The value can be set to, e.g., udp (ctrl_interface=udp)

#

# For Windows Named Pipe: This value can be used to set the security
descriptor

# for controlling access to the control interface. Security descriptor
can be

# set using Security Descriptor String Format (see http://msdn.microsoft.com/

# library/default.asp?url=/library/en-us/secauthz/security/

# security_descriptor_string_format.asp). The descriptor string needs
to be

# prefixed with SDDL=. For example, ctrl_interface=SDDL=D: would set
an empty

# DACL (which will reject all connections). See README-Windows.txt for
more

# information about SDDL string format.

#

#ctrl_interface=wlan0

ctrl_interface=DIR=/data/system/wpa_supplicant/ GROUP=system



(4.2) setting default AccessPoint value:



# Only WPA-PSK is used. Any valid cipher combination is accepted.

network={

       ssid="example"         // AP name

       proto=WPA            //encypted method

       key_mgmt=WPA-PSK   //using psk

       pairwise=CCMP TKIP

       group=CCMP TKIP WEP104 WEP40

 
psk=06b4be19da289f475aa46a33cb793029d4ab3db7a23ee92382eb0106c72ac7bb

       priority=2

}



(5)   Add directory which is needed when enable wifi under linux,

System/core/rootdir/init.rc





    # give system access to wpa_supplicant.conf for backup and restore

    mkdir /data/misc/wifi 0770 wifi wifi

    chmod 0770 /data/misc/wifi

    chmod 0660 /data/misc/wifi/wpa_supplicant.conf

    mkdir /data/misc/wifi/sockets 0770 wifi wifi

    mkdir /data/misc/android 0770 wifi wifi

    mkdir /data/system/wpa_supplicant 0770 wifi wifi

    mkdir /data/misc/dhcp 0770 dhcp dhcp

    chown dhcp dhcp /data/misc/dhcp

    chmod 0555 /system/bin/busybox



(6)   Modify HAL code, hardware/libhardware_legacy/wifi/wifi.c

Re-define the include path



#ifndef WIFI_DRIVER_MODULE_PATH

//#define WIFI_DRIVER_MODULE_PATH        "/system/lib/modules/wlan.ko"

#define WIFI_DRIVER_MODULE_PATH      "/lib/modules/rt3070sta.ko"

#endif

#ifndef WIFI_DRIVER_MODULE_NAME

//#define WIFI_DRIVER_MODULE_NAME         "wlan"

#define WIFI_DRIVER_MODULE_NAME         "ra0"

#endif

#ifndef WIFI_DRIVER_MODULE_ARG

#define WIFI_DRIVER_MODULE_ARG          ""

#endif

#ifndef WIFI_FIRMWARE_LOADER

#define WIFI_FIRMWARE_LOADER            ""

#endif

#define WIFI_TEST_INTERFACE             "sta"

(7)   Make and place driver relative file after boot.
place rt3070sta.ko at /lib/modules/
place RT2870STA.dat at  /etc/Wireless/RT2870STA/  (it is driver
needed)
place libiw.so.29 at /lib  (it is driver needed)

(8) select "Settings" -> "Wireless&networks" -> "Wi-Fi" in Android
I found the wifi module has been inserted. and I got the logcat.
====================
D/SettingsWifiEnabler( 1153): Received wifi state changed from
Disabled to Enabling
rtusb init --->
ra0 (usb): not using net_device_ops yet
usbcore: registered new interface driver rt2870

====================

but soon it fail and throws the log
====================
init: no such service 'wpa_supplicant'
====================

Does anyone have any suggestion or ideal????

-- 
unsubscribe: android-porting+unsubscr...@googlegroups.com
website: 

2. Connecting Splash Screen to GPS App

I'm new to Android development and I'm working on writing a GPS app. I
want to have a title/splash screen displayed when the app is first
opened, and then after a few seconds display the map. I made this
splash screen by following a tutorial and have it saved it a separate
Eclipse project. So I have 2 separate projects that each run
individually but I can't figure out how to put them together. I think
I am having trouble with the XML files.

 Can someone explain how to have a splash screen displayed before your
app runs?

Thanks

-- 

3. Moving CursorAdapter cursor creation to background thread

4. Soft keys N1 musti tekan diatas icon

5. Sorry, the player does not support this type of audio file ERROR

6. "geo fix" loses longitude/latitude precision

7. Shoutcast for Android