java.lang.OutOfMemoryError: bitmap size exceeds VM budget (in the charts example)

mc73

Well-Known Member
Licensed User
Longtime User
Hi, I am using the charts example in order to draw three different type of charts in a tabhost (similarly to the example). Now, a bar chart has around 200*4=800 bars, and I get the vm error. Of course I can avoid it by drawing the chart on the fly by forcing a button click (left and right) and invalidating each time the shown part of the chart, yet, I find the horizontal scrollview I'm using, pretty impressive. Any workaround? Here's the full log of the error:

charts_drawbarschart (B4A line: 458)
BD.Canvas.Initialize(BD.Target)
java.lang.OutOfMemoryError: bitmap size exceeds VM budget
at android.graphics.Bitmap.nativeCreate(Native Method)
at android.graphics.Bitmap.createBitmap(Bitmap.java:477)
at anywheresoftware.b4a.objects.drawable.CanvasWrapper.Initialize(CanvasWrapper.java:72)
at wos.android.charts._drawbarschart(charts.java:662)
at wos.android.chartsscreen._createbarstab2(chartsscreen.java:1083)


at wos.android.chartsscreen._astreamsx2_newdata(chartsscreen.java:471)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:507)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:170)
at anywheresoftware.b4a.BA$3.run(BA.java:296)
at android.os.Handler.handleCallback(Handler.java:587)
at android.os.Handler.dispatchMessage(Handler.java:92)
at android.os.Looper.loop(Looper.java:123)
at android.app.ActivityThread.main(ActivityThread.java:3683)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:507)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
at dalvik.system.NativeStart.main(Native Method)
 

mc73

Well-Known Member
Licensed User
Longtime User
I am not in front of my pc for development right now, so I don't know the size. Yet, I am using this example, with no other modification apart from replacing a panel with a horizontalScrollView. I will check the code and try a scae-down, sure!
 
Upvote 0
Top