After 200,000 iterations and before 300,000 iterations, it simply dies. Spits out over 30kb of errors into a log file. Why does this happen? The equivallent code in perl...//======================================================= import java.io.*; class dup { public static void main(String args[]) { dupme ob = new dupme(0); }// end main() }// end class dup class dupme { public dupme(int me) { System.out.println("I am '" + me + "'!"); dupme ob = new dupme(me + 1); }// end interface dumpe(int me) }// end class dupme() //=======================================================
...ran faster (on my machine) and did not exit until 853865 iterations. I realize this is comparing apples to horses, but what does this tell me? Considering the way objects are started, exist and are destroyed in each VM is quite different, I realize this is the result of perhaps thousands of differences and 2 completely different development perspectives. On windows98, AMD500, 296Mb RAM, the java one ran only to just over 4000 iterations, while the perl version went beyond 2,000,000 iterations! I wonder why, if Java is supposed to have such slick garbage collection, does it have _any_ kind of problem?#======================================================= package main; my $ob = dupme->new(0); package dupme; sub new { my $s = {}; bless $s; print "I am '$_[1]'!\n"; my $ob = $s->new($_[1]+1); return $s; }# end sub new #=======================================================
In reply to Memory Use/Garbage Collection: Java vs Perl by c0d3cr33p
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |