title: for loop recursion with a n-ary tree node
body: <p>The recursive function call abruptly stucks after reaching a limit.</p>
  
  <p>when the function is called from main, the root node is passed first, and in a loop the children of root node is checked for the size's value and recursively the same function is called on that child to sets its size value.</p>
  
  <p>my input is very big tree. when i print the n-ary tree before setting the size for the elements in the tree, the list is getting printed with all the elements. but, during the setsize() recursion, the execution hangs at a particular point un-meaningfully. everytime the execution stops at the same element. if i remove the elements after that element where it hangs from my input while creating the n-ary tree, the execution is successful and does not hangs.</p>
  
  <p>i tried increasing -Xss -Xmx -Xss. still no use.</p>
  
  <p>do i got to use threading or pls let me know if any issues in my below recursive method for the above explained function implementation. Thx!!</p>
  
  <pre><code>public void setsize(Element inEle){
          for(int i =0;i&lt;inEle.children.size();i++){
              if(inEle.children.get(i).size==0)
              {                   
                  this.setsize(inEle.children.get(i));
                  i--;
              }else
              {
                  if(!inEle.children.get(i).isRedefine)
                      inEle.size=inEle.size+inEle.children.get(i).size;                   
              }
          }
          inEle.size=inEle.size*inEle.occurs;
      }
  </code></pre>