Clojure

1.3 alpha 6 seems to hold on to head in a case when 1.2 does not

Details

  • Type: Defect Defect
  • Status: Closed Closed
  • Priority: Minor Minor
  • Resolution: Completed
  • Affects Version/s: Release 1.3
  • Fix Version/s: Release 1.3
  • Component/s: None
  • Labels:
    None
  • Environment:
    I tested on both Mac OS X 10.6.6 with Hotspot 64-bit JVM 1.6.0_24, and Ubuntu Linux 10.4 LTS with Hotspot 64-bit JVM 1.6.0_24. I suspect the issue is similar across JVMs.

Description

File names here refer to attached files. Instead of attaching a large input file, I attach a small program that can be run to generate a large input file. To generate it, edit make-input-file.sh to point to a Clojure 1.2 JAR. Also edit run.sh to point to a Clojure 1.2 and 1.3 alpha 6 JAR. Do the following one time to create a ~ 125 Mbyte file long-input.txt:

./make-input-file.sh

With the JVMs I tested, I got these results, where the first argument is 1.2 or 1.3 for the Clojure version, and the second argument is the number of Mbytes to use for the max heap size of the JVM (i.e. the numeric value in the -Xmx<num>m argument in the java command line):

./run.sh 1.2 384 # failed with OutOfMemoryError 5/5 times tried
./run.sh 1.2 416 # succeeded 5/5 times tried

./run.sh 1.3 960 # failed 5/5 times tried
./run.sh 1.3 1048 # succeeded 5/5 or 4/5 times tried, for Mac OS X or Linux, respectively

I believe the issue is that with 1.3 alpha 6, the JVM is holding on to the head of the sequence called 'lines' for the duration of the execution of the function fasta-dna-str-with-desc-beginning, whereas 1.2 is losing the head after getting past the first when-let, and thus using significantly less memory.

  1. fasta.clj-11.clj
    15/Mar/11 2:09 AM
    7 kB
    Andy Fingerhut
  2. make-input-file.sh
    15/Mar/11 2:09 AM
    0.3 kB
    Andy Fingerhut
  3. read.clj
    15/Mar/11 2:09 AM
    0.9 kB
    Andy Fingerhut
  4. run.sh
    15/Mar/11 2:10 AM
    2 kB
    Andy Fingerhut

Activity

Hide
Tassilo Horn added a comment -

Works fine with 416MB using what will become clojure-1.4.0 (commit 59d3c724684c212fbb5eafaaaac30761c2c75a37).

Show
Tassilo Horn added a comment - Works fine with 416MB using what will become clojure-1.4.0 (commit 59d3c724684c212fbb5eafaaaac30761c2c75a37).
Hide
Andy Fingerhut added a comment -

Thanks for checking, Tassilo. I also verified that the head-holding issue is gone in 1.3.0 and latest 1.4.0-beta1 as of Feb 13, 2012 (commit e27a27d9a6dc3fd0d15f26a5076e2876007e0ae6). I will mark this issue resolved, although I don't know which particular changes did it.

Show
Andy Fingerhut added a comment - Thanks for checking, Tassilo. I also verified that the head-holding issue is gone in 1.3.0 and latest 1.4.0-beta1 as of Feb 13, 2012 (commit e27a27d9a6dc3fd0d15f26a5076e2876007e0ae6). I will mark this issue resolved, although I don't know which particular changes did it.

People

Vote (0)
Watch (0)

Dates

  • Created:
    Updated:
    Resolved: