使用 8900 黑莓时出现 OutOfMemory 异常
我在黑莓上开发了一款应用程序。它在 8520 和 9000 上工作正常,但当我在 8900 上测试它时。它在一段时间后给出内存不足异常。我在 JDE 调试中收到以下消息:
OutOfMemoryError
No detail message
net_rim_cldc-6(4A0CB600)
Bitmap
<init>
0x8822
net_rim_cldc-6(4A0CB600)
Bitmap
<init>
0x84A5
net_rim_cldc-7(4A0CB600)
PNGEncodedImage
getBitmapImpl
0x39BD
net_rim_cldc-7(4A0CB600)
EncodedImage
getBitmap
0x10F6
net_rim_cldc-7(4A0CB600)
EncodedImage
getBitmap
0x10CE
Triton-5(4DA2E09E)
Utility
resizeAlert
0x7F9D
Triton-1(4DA2E09E)
AlertScreen
paintBackground
0x938
net_rim_cldc-8(4A0CB600)
Field
applyTheme
0x1071
net_rim_cldc-8(4A0CB600)
Field
paintSelf
0x26F0
net_rim_cldc-8(4A0CB600)
Manager
paintSelf
0x9230
net_rim_cldc-9(4A0CB600)
Screen
doPaint0
0x41D3
net_rim_cldc-9(4A0CB600)
UiEngineImpl
<private>
0xB576
net_rim_cldc-9(4A0CB600)
UiEngineImpl
doPainting
0x93AB
net_rim_cldc-9(4A0CB600)
UiEngineImpl
pushModalScreen
0xA983
net_rim_cldc-9(4A0CB600)
UiApplication
pushModalScreen
0x9089
Triton-1(4DA2E09E)
AlertScreen
show
0x836
Triton-2(4DA2E09E)
CloseCall
update
0xBDF
Triton-5(4DA2E09E)
Request$4
run
0x638B
net_rim_cldc-6(4A0CB600)
Application
dispatchInvokeLater
0xAD1
net_rim_cldc-6(4A0CB600)
Application
processNextMessage
0x127A
net_rim_cldc-6(4A0CB600)
Application
enterEventDispatcher
0xA76
Triton(4DA2E09E)
TritonClient
runApp
0x3800
Triton(4DA2E09E)
TritonClient
main
0x3825
我已使用持久数据库、HTTP 连接线程。我不明白为什么我只用8900。
提前致谢...
I have develop one application on blackberry. It is working fine on 8520 and 9000 but when I test it on 8900. Its giving Out Of Memory exception with in some time. I got following message on JDE's debug
OutOfMemoryError
No detail message
net_rim_cldc-6(4A0CB600)
Bitmap
<init>
0x8822
net_rim_cldc-6(4A0CB600)
Bitmap
<init>
0x84A5
net_rim_cldc-7(4A0CB600)
PNGEncodedImage
getBitmapImpl
0x39BD
net_rim_cldc-7(4A0CB600)
EncodedImage
getBitmap
0x10F6
net_rim_cldc-7(4A0CB600)
EncodedImage
getBitmap
0x10CE
Triton-5(4DA2E09E)
Utility
resizeAlert
0x7F9D
Triton-1(4DA2E09E)
AlertScreen
paintBackground
0x938
net_rim_cldc-8(4A0CB600)
Field
applyTheme
0x1071
net_rim_cldc-8(4A0CB600)
Field
paintSelf
0x26F0
net_rim_cldc-8(4A0CB600)
Manager
paintSelf
0x9230
net_rim_cldc-9(4A0CB600)
Screen
doPaint0
0x41D3
net_rim_cldc-9(4A0CB600)
UiEngineImpl
<private>
0xB576
net_rim_cldc-9(4A0CB600)
UiEngineImpl
doPainting
0x93AB
net_rim_cldc-9(4A0CB600)
UiEngineImpl
pushModalScreen
0xA983
net_rim_cldc-9(4A0CB600)
UiApplication
pushModalScreen
0x9089
Triton-1(4DA2E09E)
AlertScreen
show
0x836
Triton-2(4DA2E09E)
CloseCall
update
0xBDF
Triton-5(4DA2E09E)
Request$4
run
0x638B
net_rim_cldc-6(4A0CB600)
Application
dispatchInvokeLater
0xAD1
net_rim_cldc-6(4A0CB600)
Application
processNextMessage
0x127A
net_rim_cldc-6(4A0CB600)
Application
enterEventDispatcher
0xA76
Triton(4DA2E09E)
TritonClient
runApp
0x3800
Triton(4DA2E09E)
TritonClient
main
0x3825
I have used persistent database, threads for HTTP connection. I am not getting exactly why I its coming on 8900 only.
Thanks in advance...
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您的应用程序是否使用任何 PNG 图像资源?看起来确实如此,并且看起来某些 PNG 图像足够大,在从图像创建
Bitmap
实例时会导致OutOfMemoryError
。我的开发经验表明,这取决于操作系统版本、设备型号和当前设备 RAM 状态。因此,不要感到惊讶它可以在一台设备上运行,但不能在另一台设备上运行。为了防止OutOfMemoryError
,只需确保您的位图
尺寸不大于显示尺寸的两倍。例如,如果您的显示器为 320x240,则不要使用大于 640x480 的位图。Does your app use any PNG image resources? Looks like it does and looks like some PNG image is big enough to cause an
OutOfMemoryError
when aBitmap
instance is being created from the image. My development experience says that it depends on OS version, device model and current device RAM state. So don't be surprised it works on one device and doesn't on another. To prevent theOutOfMemoryError
just make sure yourBitmap
dimentions is not greater than doubled display dimentions. For instance, if your display is 320x240, then don't use Bitmaps larger than 640x480.