Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 24 Nov 2001 22:10:21 -0800 (PST)
From:      huang wen hui <huanghwh@yahoo.com>
To:        freebsd-java@freebsd.org
Subject:   GC is not work in jdk1.3.1p5+OpenJIT1.1.16
Message-ID:  <20011125061021.71089.qmail@web20410.mail.yahoo.com>

next in thread | raw e-mail | index | archive | help
hi,
 Here is the sample code:
-----------------------------------------
import java.util.LinkedList;
import java.util.List;
import javax.swing.event.EventListenerList;

public class FixQueue extends Object{
  protected EventListenerList listenerList = new
EventListenerList();

  private FixQueueException fixQueueExcep
          = new FixQueueException("Queue's
MaxQueueLength is Exceed");
  private LinkedList list;
  private int maxQueueSize;
  protected String queueID ="";

  public FixQueue(int newMaxQueueSize, String queueID)
{
    maxQueueSize = newMaxQueueSize;
    this.queueID = queueID;
    list = new LinkedList ();
  }

  public synchronized int getListenerCount() {
    return listenerList.getListenerCount();
  }


  public void addBack(Object obj) {
    list.addLast (obj);
    if ( list.size () > maxQueueSize ){
      list.removeFirst ();
    }
  }

  protected void addBackNoNotify(Object obj){
    list.addLast (obj);
    if ( list.size () > maxQueueSize ){
      list.removeFirst ();
    }
  }

  public Object getFront() {
    return list.getFirst ();
  }

  public Object getBack() {
    return list.getLast ();
  }

  public boolean isEmpty() {
    return list.isEmpty ();
  }

  public void popFront() {
    list.removeFirst ();
  }

  public Object at(int index) {
    return list.get (index);
  }

  public int getSize(){
    return list.size();
  }

  public int getMaxQueueSize(){
    return maxQueueSize;
  }

  public String getQueueID(){
    return queueID;
  }


  public static void main( String[] argv ){
    FixQueue fixQueue = new FixQueue(4096,"ID");
    while(true) {
    	fixQueue.addBack(new byte[4096]);
    }
  }

}

class FixQueueException extends Exception {

  public FixQueueException() {
    super();
  }

  public FixQueueException(String s) {
    super(s);
  }
}
-----------------------------------------
when run under jdk1.3.1p5 that enable OpenJIT1.1.16,
the program will eat a lot of memory as posible as it
can. and error msg is :
Exception in thread "main"
java.lang.StackOverflowError
        at
java.util.LinkedList.addBefore(LinkedList.java,
Compiled Code)
        at
java.util.LinkedList.addLast(LinkedList.java, Compiled
Code)
        at FixQueue.addBack(FixQueue.java, Compiled
Code)
        at FixQueue.main(FixQueue.java, Compiled Code)


If disable OpenJIT, it worked as expected. 

--hwh



__________________________________________________
Do You Yahoo!?
Yahoo! GeoCities - quick and easy web site hosting, just $8.95/month.
http://geocities.yahoo.com/ps/info1

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-java" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20011125061021.71089.qmail>