JDK-4641910 : java.exe Application Error in Win2K
  • Type: Bug
  • Component: hotspot
  • Sub-Component: gc
  • Affected Version: 1.4.0
  • Priority: P4
  • Status: Closed
  • Resolution: Duplicate
  • OS: windows_2000
  • CPU: x86
  • Submitted: 2002-02-22
  • Updated: 2002-02-25
  • Resolved: 2002-02-25
Description

Name: rmT116609			Date: 02/22/2002


FULL PRODUCT VERSION :
java version "1.4.0"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.0-b92)
Java HotSpot(TM) Client VM (build 1.4.0-b92, mixed mode)

DESCRIPTION OF THE PROBLEM :

Am creating a bunch of arrays and hooking them together by storing the pointer to the previous array in the 0 element of the newly created array.

Memory or the stack is filling up and the VM is crashing.

EXPECTED VERSUS ACTUAL BEHAVIOR :
An out of memeory or stack overflow error.

ERROR MESSAGES/STACK TRACES THAT OCCUR :

"java.exe has generated errors and will be closed by Windows. You will need to restart the program. An error log is being created."
                    
This bug can be reproduced always.

---------- BEGIN SOURCE ----------
public class ArrayBug
{
  private int topI, botI;
  private Object[] topA, botA;

  public ArrayBug()
  {
    topA = botA = new Object[20];
    botI = 10;
    topI = 11;
  }

  private void add(Object object)
  {
    if (++botI == 20)
    {
      Object tmp = botA;
      botA = new Object[20];
      botA[0] = tmp;
      botI = 1;
    }

    botA[botI] = object;
  }

  private Object get()
  {
    Object ret = botA[botI];
    botA[botI] = null;

    if (--botI < 1)
    {
      botA = (Object[])botA[0];
      botI = 19;
    }

    return ret;
  }

  public void test(int cnt)
  {
    int i;

    for (i = 0; i < cnt; i++)
    {
      add(new Integer(i));
    }

    for (i = 0; i < cnt; i++)
    {
      get();
    }
  }

  public static void main(String[] args)
  {
    ArrayBug bug = new ArrayBug();
    bug.test(1000000);
  }
}
---------- END SOURCE ----------
(Review ID: 143174) 
======================================================================

Comments
EVALUATION Based on eval of bug 4396719, Peter has determined that this is the same bug. Therefor, closing this one as a duplicate of that bug. ###@###.### 2002-02-25
25-02-2002

WORK AROUND Increase your -Xmx and -Xms values and this should pass. ??? gary.collins ??? Increasing your -Xmx (and -Xms) values just increases the size of the young generation to the point where you can survive this particular depth of data structure without needing a full collection. The "real" workaround is to increase the size of the thread stack for the marking process. In this case, -Xss4m works. In other cases you'd need a larger or smaller stack. And increaing -Xss increases all the thread stacks, not just the one for the collector. ###@###.### 2002-02-22
22-02-2002