tseemann / snp-dists

Pairwise SNP distance matrix from a FASTA sequence alignment
GNU General Public License v3.0
126 stars 28 forks source link

Stackoverflow #9

Closed kloetzl closed 6 years ago

kloetzl commented 6 years ago

MAX_SEQ is defined as 1000000 which requires massive amounts of stack memory for compute_distance_matrix (15MB). Too much for my system, which only allows 8MB, thus triggering a segfault. I think 1000 should be a reasonable default value; or switch to a heap allocated dynamic array. In any case, N should be checked to not exceed MAX_SEQ.

kloetzl commented 6 years ago

In any case, N should be checked to not exceed MAX_SEQ.

This is actually very important, as it it surprisingly easy to produce a bad estimate:

>very-long-name
A
>p
A
>q
A
tseemann commented 6 years ago

Agreed - lazy programming on my part. Will change to dynamic heap.