This is the mail archive of the java@gcc.gnu.org mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: gcj: mem leaks & speed.


For a memory allocation performance comparison, try something
(slightly) more realistic, like this:

public class Leak {
  static Leak head;
  Leak prev;
  Leak ()
  {
	prev = head;
	head = this;
  }
	
  static final int iters = 1000000;

  public static void main(String[] argv) {
	long start = System.currentTimeMillis();
	for (int i = 0;; i++) {
	  Leak l = new Leak();
	  if (i % iters == 0) {
		long curr = System.currentTimeMillis();
		System.out.println(i / iters + ": " + (curr - start));
		head = null;
	  }
	}
  }
}


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]