Fatal signal 16 (SIGSTKFLT) has been occured unexpectedly

坚强是说给别人听的谎言 提交于 2019-12-01 14:29:57

SIGSTKFLT happens when the device runs out of memory, esp. when using malloc() calls in the underlying linux OS layer. When the OS cannot return a fail in malloc, it generates a fatal signal of this kind.

Try using some memory saving techniques(like late binding image decoding) to fix the above issues on low memory devices, when dealing with images as they occupy a lot of memory.

For a start, You can try re-sizing the image to the screen resolution or lower, before posting it to the canvas.

Thanks everybody for supporting me! I found true cause of my problem. It was just a stupid approach to an issue of correct threading. The sequence of events invoked, for example, on start, was the following:

WallpaperService.onCreate()

onSharedPreferenceChanged()

WallpaperService.onCreateEngine()

Engine.onCreate()

Engine.onSurfaceCreated() (here DrawTask #1 was created)

Engine.onSurfaceChanged() (here DrawTask #2 was created)

Engine.onVisibilityChanged() (here DrawTask #3 was created)

Engine.onOffsetChanged() (here DrawTask #4 was created)

Engine.onOffsetChanged() (here DrawTask #5 was created)

Engine.onOffsetChanged() (here DrawTask #6 was created)

Engine.onOffsetChanged() (here DrawTask #7 was created)

Engine.onOffsetChanged() (here DrawTask #8 was created)

Engine.onOffsetChanged() (here DrawTask #9 was created)

Engine.onOffsetChanged() (here DrawTask #10 was created)

Engine.onOffsetChanged() (here DrawTask #11 was created)

Engine.onOffsetChanged() (here DrawTask #12 was created)

Engine.onOffsetChanged() (here DrawTask #13 was created)

DrawTask #2 was stopped

DrawTask #3 was stopped

DrawTask #4 was stopped

DrawTask #6 was stopped

DrawTask #5 was stopped ...

So, I removed all AsyncTask generation overall, except onVisibilityChanged() and onSurfaceChanged() if variable mVisible is true. And now it's OK at least for all of my devices.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!