Dalvik 栈空间大小

来源:互联网 发布:买宠物的软件 编辑:程序博客网 时间:2024/06/07 17:05

Dalvik had separate stacks for native and Java code, with a default Java stack size of 32KB and a default native stack size of 1MB.

java栈32KB,Native栈 1MB


如果线程的栈空间不足,报了StackOverflowError 错误。可以将设置更大的栈空间。

设置方式,注意Native 设置方法是在ART模式下:

  • In Java, review calls to the Thread constructor that specify an explicit stack size. For example, you will need to increase the size if StackOverflowError occurs.
  • In C/C++, review use of pthread_attr_setstack() and pthread_attr_setstacksize() for threads that also run Java code via JNI. Here is an example of the error logged when an app attempts to call JNIAttachCurrentThread() when the pthread size is too small:
    F/art: art/runtime/thread.cc:435]    Attempt to attach a thread with a too-small stack (16384 bytes)

0 0
原创粉丝点击