in reply to Memory Use/Garbage Collection: Java vs Perl
Java doesn't garbage-collect until the variable 'exits scope'. While Perl's garbage-collection has very ill-defined timing, it can collect anything that is syntactically unusable.
This makes the print statement (and its Java analog) the most likely issue.
So a clumsy Java translation will literally permanently allocate more memory on each recursion. The overhead of Sun's JVM is also much larger than the overhead for Perl. For the more recent ones, Sun recommends assuming 64MB of RAM just to launch their JVM.
Also, Java finalizers execute asynchronously, and are not guaranteed to be executed after the last access of the data object they finalize. A priori, the Java crash could be due to the program attempting to use a finalized (garbage-collected) object. (Perl has similar issues when globally shutting down modules -- but this is after the Perl program is finished.)
|
|---|