throw an error if insufficient memory during index

This commit is contained in:
Heng Li 2011-10-31 13:26:24 -04:00
parent 02946df28a
commit 673ae4aaf8
2 changed files with 5 additions and 1 deletions

4
bwt.c
View File

@ -56,6 +56,10 @@ void bwt_cal_sa(bwt_t *bwt, int intv)
bwt->sa_intv = intv; bwt->sa_intv = intv;
bwt->n_sa = (bwt->seq_len + intv) / intv; bwt->n_sa = (bwt->seq_len + intv) / intv;
bwt->sa = (bwtint_t*)calloc(bwt->n_sa, sizeof(bwtint_t)); bwt->sa = (bwtint_t*)calloc(bwt->n_sa, sizeof(bwtint_t));
if (bwa->sa == 0) {
fprintf(stderr, "[%s] Fail to allocate %.3fMB memory. Abort!\n", __func__, bwt->n_sa * sizeof(bwtint_t) / 1024.0/1024.0);
abort();
}
// calculate SA value // calculate SA value
isa = 0; sa = bwt->seq_len; isa = 0; sa = bwt->seq_len;
for (i = 0; i < bwt->seq_len; ++i) { for (i = 0; i < bwt->seq_len; ++i) {

2
main.c
View File

@ -4,7 +4,7 @@
#include "utils.h" #include "utils.h"
#ifndef PACKAGE_VERSION #ifndef PACKAGE_VERSION
#define PACKAGE_VERSION "0.6.0-r69-dev" #define PACKAGE_VERSION "0.6.0-r70-dev"
#endif #endif
static int usage() static int usage()