Lingjie,can you submit a minimal demo program that compiles and shows your error? Please compile it on your computer and run it under valgrind [1,2] and make sure that a memory leak is reported.
I just replaced "MyersHirschberg" with "MyersBitVector" in the demos/ alignment.cpp file, compiled it and ran it through valgrind. Valgrind [1,2] reported no memory leaks, so it is very unlikely that this function produces leaks per se in the current trunk version.
If it turns out that your memory leak is in another position, valgrind is a very useful and versatile tool to find such leaks. You will find many high-quality tutorials on the internet.
There are known leaks with the last release version when using SeqAn Strings of non-POD types (i.e. objects that allocate memory and where the destructor has to be called in order to free memory) that is fixed in the current trunk version. A workaround here, is to upgrade to the trunk version or use std::vector<> objects. Also, the SeqAn Map specialization based on skiplists is known to leak memory. Use another specialization or std::map<,> directly.
What SeqAn version are you using? The last release version? May I recommend you to try out the trunk version and check whether the problem persists?
Bests, Manuel [1] http://www.valgrind.org [2] http://lh3lh3.users.sourceforge.net/memdebug.shtml Am 17.05.2011 um 23:59 schrieb Lingjie Weng:
Dear Seqan team, I am interested in our Seqan C++ library, it is really helpful. But I got some problem when try to use the function "globalAlignment(Align<TSource, TSpec> & align_,Score<TScoreValue, Simple> const &, MyersBitVector" in seqan/align/align.myers.h file. I was trying to call this function in my project, I called it in this way (got those code from /demos/alignment.cpp) : typedef String<Dna> TSequence; TSequence seq1 = "atcgaatgcgga"; TSequence seq2 = "actcgttgca"; Score<int> score(0, -1, -1, -2); Align<TSequence, ArrayGaps> align; resize(rows(align), 2); assignSource(row(align, 0), seq1); assignSource(row(align, 1), seq2); ::std::cout << "Score = " << globalAlignment(align, score, MyersBitVector()) << ::std::endl; I found you have internally clean up the memory in the function "globalAlignment ()". My question is how could clean up the memory I allocated for initialization, for example, Tsequence, align... When I am using it for millions of reads alignment, the memory keeps increasing, which turns out to be a big issue to me. Do you have any idea how to release memory properly? I really appreciate if you could show me how to fix it. I am looking forward to your reply. Thanks, Lingjie PhD student University of California, Irvine _______________________________________________ seqan-dev mailing list seqan-dev@lists.fu-berlin.de https://lists.fu-berlin.de/listinfo/seqan-dev
-- Manuel Holtgrewe manuel.holtgrewe@fu-berlin.de Freie Universität Berlin http://www.inf.fu-berlin.de/ Institut für Informatik Phone: +49 30 838 75246 Takustraße 9 Algorithmic Bioinformatics 14195 Berlin Room 021