`

java stack size

    博客分类:
  • JAVA
阅读更多

摘录自 http://bugs.sun.com/bugdatabase/view_bug.do;jsessionid=f621bd69b8b1a1425b9a88233de3?bug_id=4765019

 

 

the default stack size is 1 MB if not specified with -Xss and this result in calculation of _os_thread_limit be around 1800 (= (2GB - 200 MB ) / 1MB. After hit the limit, jvm code begins to try to reserve 20 MB first to see if there is enough virtual memory left, if not, "OutOfMemeory Error" thrown. The reserve only purpose for test, then released if reserve succeed. JVM create native Windows thread using the default stack size 0. Problem happens when on a MP machine with multiple thread creation that reserving 20 MB and commmiting stack space interlaced results in memory fragmented so finally, no single block is bigger enough than 20 MB even the total available virtual memory is far more than 20 MB.

 

 

With -Xss256K, the _os_thread_limit is about 7200. The question lands on the stack size used in calling _beginthreadex, since within the _os_thread_limit, reserve memory will not be invoked. Calling _beginthreadex even worse with specifying a stack commit size, even there is alot explaination of better not to specify stack size to create thread, a question still exists there like in attached example(C++): in this example, the stack size never grow out of 256K, but we still fail to create more threads, failed btw 1300-1700 with specifying 256K as stack size. Think it is a Microsoft bug.

 

 

Current solution is supply a XX flag(VM) upon turned on 0 as the argument passed to _beginthreadex as the commit stacksize, and meanwhile use -Xss256K to avoid triggering reserving 20 MB , and thread number can go up to 7000.

 

分享到:
评论

相关推荐

    深入java虚拟机(inside the java virtual machine)

    Possible Implementations of the Java Stack Native Method Stacks Execution Engine The Instruction Set Execution Techniques Threads Native Method Interface The Real Machine Eternal Math: A ...

    栈的Java语言实现

    栈的顺序存储结构及Java实现 //MyStack.java public class MyStack { int MAX_SIZE = 100; int top; String[] stack; public void init(String[] array){ stack = new String[100]; top = -1; for (int i = ...

    solr文档solr文档

    solr文档

    java虚拟机参数

    -Xss<size> 设置java线程栈存储(stack)大小。 -Xprof 输出CPU概况数据 -Xrunhprof[:help]|[:<option>=, ...] 执行 Java Virtual Machine Profiler Interface(Java虚拟机探查接口)的堆,CPU,或者...

    用Java语言实现的各种排序.doc

    用Java语言实现的各种排序,包括插入排序、冒泡排序、选择排序、Shell排序、快速排序、归并排序、堆排序、SortUtil等 插入排序法 package org.rut.util.algorithm.support; import org.rut.util.algorithm.SortUtil;...

    基于windows平台java for usb开发

    JavaSources里面是源代码 直接执行RunUSBControllerTest.java即可 以下是我的执行结果 >>> RunUSBControllerTest: Observation Time = 1s No Configuration Descriptor Builded for that device >>> USB Device ...

    list、queue、stack:在matlab中实现list、queue、stack数据结构-matlab开发

    它喜欢 java.util.Stack,但是,它可以使用 CStack.content() 来返回堆栈的所有数据(在单元格中),并且速度更快比java的堆栈。 s = CStack(c); c 是一个单元格,可以省略s.size() 返回元素的数量s.empty() 返回栈...

    java8源码-csn-list:ArrayList、LinkedList、Vector、Stack源码分析

    java8 源码 List相关实现类的源码解析(JDK1.8) 2018.9.22- List的架构图 ArrayList 继承关系: ArrayList -> AbstractList 实现 List接口 ArrayList 是一个数组队列,相当于 动态数组。与Java中的数组相比,它的...

    达内 coreJava 习题答案

    import java.util.Scanner; class Bissextile{ public static void main(String[] arge){ System.out.print("请输入年份"); int year; //定义输入的年份名字为“year” Scanner scanner = new Scanner(System.in...

    Problem Solving in Data Structures & Algorithms Using Java, 2nd Edition

    Size: 10 Mb ASIN: B07HRNP1WW Book Description to Finelybook sorting “Problem Solving in Data Structures & Algorithms” is a series of books about the usage of Data Structures and Algorithms in ...

    表达式的求解,可以是多位数和小数

    const int MAX_SIZE = 100; //堆栈类 template class Stack { private: Type list[MAX_SIZE]; int top;//标记 public: Stack(); void Push(const Type & a);//入栈 Type Pop();//出栈 void Clear...

    java课程实验

    (4)size:返回当前链表中对象的个数;(5)isEmpty:判断链表是否为空;(6)traverse:遍历链表,打印出所有的元素;(7)getData:取得某个位置的对象。构造main函数进行测试。 实验三 1、按照要求使用Java进行...

    java8stream源码-java:java及相关(电话/微信:15850669069,qq:1056764180)

    java8 stream 源码 java java及相关 学习java网站链接 ...Stack (Buffers Size) To Increase Networking Performance]) c++ 其他 [Real Time Analytics with Druid, Spark, and Kafka (Outbrain)])

    Java-Collections-Benchmark:展示每个集合的CRUD性能的基准

    概括 列表:用于创建的LinkedList,用于读取的ArrayList,用于更新和删除的堆栈(切勿使用LinkedList进行删除)。 Maps :HashMap用于创建和删除,...Stack create 1 million execution time: 36ms. Current size:

    CardStackView

    CardStackView Samall的trick俩模仿了“卡片叠效果”。 支持自定义堆栈大小(0..5)和2个堆栈方向(向下,向上)。 两者都可以在运行时更改。 ##如何使用: 在模块的gradle.build中... stack : stackSize = " 5

    leetcode二维数组搜索-algm:JavaScript/TypeScript的快速算法库

    参加leetcode等在线算法竞赛或编码算法题时,可以选择c++,java,python。 因为他们有像 STL 这样的内置库,包含优先队列、顺序集等。 安装 npm install algm 文档 您可以找到algm 文档。 为什么是algm? 安全的 ...

    HXSDKHelper.java 环信Demo 

    * activityList.size() 意味着所有页面都已经在后台运行,或者已经离开Activity Stack */ protected void initEventListener() { eventListener = new EMEventListener() { private BroadcastReceiver ...

    leetcode双人赛-DataStructure:基于Java的数据结构

    Java数据基本结构底层实现 数据结构研究的是数据如何在计算机中组织和存储,使得我们可以高效地获取数据和修改数据. 我们需要根据应用场景的不同,灵活选择最合适的数据结构. 算法与数据结构的核心是时间与空间之间...

    cordova-jpush:极光推送

    cd Myproj :不进入项目会出现[RangeError:Maximum call stack size exceeded] cordova platform add android cordova platform add ios Android使用PhoneGap/Cordova CLI自动安装 使用git命令将jpush phonegap...

    GifDecoder

    // max decoder pixel stack size // LZW decoder working arrays protected short[] prefix; protected byte[] suffix; protected byte[] pixelStack; protected byte[] pixels; protected ArrayList frames...

Global site tag (gtag.js) - Google Analytics