[Biojava-l] memory leak while reading nr.fasta
Gem Yang
Gem.Yang at jhu.edu
Thu Jun 30 14:29:54 EDT 2005
Hi,
I am new to Biojava.
I have the following program, which is copied from ReadFaster2 in the
cookbook.
public static void main(String[] args) {
try {
// args[0] is nr.fasta
BufferedReader br = new BufferedReader(new FileReader(args[0]));
String format = "FASTA";
String alphabet = "PROTEIN";
SequenceIterator iter =
quenceIterator)SeqIOTools.fileToBiojava(format,alphabet, br);
int count =0;
long start = System.currentTimeMillis();
while(iter.hasNext())
{
Sequence s = iter.nextSequence();
String name = s.getName();
//System.out.println(name);
s.getAnnotation();
//System.out.println(s.seqString());
count ++;
System.out.println(count);
}
long end = System.currentTimeMillis();
System.out.println("number of sequence " + count);
System.out.println("time used" + (end-start)/1000 + "seconds");
System.out.println((end-start)/1000/60 + "minutes");
}
catch (FileNotFoundException ex) {
//can't find file specified by args[0]
ex.printStackTrace();
}catch (BioException ex) {
//error parsing requested format
ex.printStackTrace();
}
}
When running this code, I got out of memory error in about half an hour and
1.5GB memory allocated. My workstation is a Windows XP with 2 GB of memory.
My biojava version is 1.3. My JRE is one came with Websphere application
developer.
Thanks.
Gem
More information about the Biojava-l
mailing list