Skip to content

Commit

Permalink
fix the memory issue
Browse files Browse the repository at this point in the history
  • Loading branch information
chhylp123 committed Dec 6, 2024
1 parent 676385c commit 184eb0a
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 16 deletions.
2 changes: 1 addition & 1 deletion CommandLines.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#include <pthread.h>
#include <stdint.h>

#define HA_VERSION "0.21.0-r686"
#define HA_VERSION "0.22.0-r687"

#define VERBOSE 0

Expand Down
10 changes: 0 additions & 10 deletions Hash_Table.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1749,16 +1749,6 @@ uint64_t lchain_qdp(k_mer_hit* a, int64_t a_n, k_mer_hit* des, Chain_Data* dp, o
return cL;
}


#define kv_pushp_ol(type, v, p) do { \
if ((v).length == (v).size) { \
(v).list = (type*)realloc((v).list, sizeof(type)*((v).size?((v).size<<1):(2))); \
memset((v).list+(v).size, 0, sizeof(overlap_region)*(((v).size?((v).size<<1):2)-(v).size));\
(v).size = (v).size?((v).size<<1):(2); \
} \
*(p) = &((v).list[(v).length++]); \
} while (0)

void push_ovlp_chain_qgen(overlap_region* o, uint32_t xid, int64_t xl, int64_t yl, int64_t sc,
k_mer_hit *beg, k_mer_hit *end)
{
Expand Down
9 changes: 9 additions & 0 deletions Hash_Table.h
Original file line number Diff line number Diff line change
Expand Up @@ -248,4 +248,13 @@ uint64_t lchain_qdp_mcopy_fast(Candidates_list *cl, int64_t a_idx, int64_t a_n,
int64_t gen_cigar, int64_t enable_mcopy, double mcopy_rate, int64_t mcopy_khit_cutoff,
int64_t khit_n);

#define kv_pushp_ol(type, v, p) do { \
if ((v).length == (v).size) { \
(v).list = (type*)realloc((v).list, sizeof(type)*((v).size?((v).size<<1):(2))); \
memset((v).list+(v).size, 0, sizeof(overlap_region)*(((v).size?((v).size<<1):2)-(v).size));\
(v).size = (v).size?((v).size<<1):(2); \
} \
*(p) = &((v).list[(v).length++]); \
} while (0)

#endif
1 change: 1 addition & 0 deletions Overlaps.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17664,6 +17664,7 @@ long long gap_fuzz, ug_opt_t *opt)
set_trio_flag_by_cov(ug, sg, cov);
// print_r_het(cov, R_INF.trio_flag, "out-1");
// print_debug_gfa(ug, sg, coverage_cut, output_file_name, sources, ruIndex);
// exit(1);

destory_hap_cov_t(&cov);
ma_ug_destroy(ug);
Expand Down
7 changes: 4 additions & 3 deletions anchor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1943,10 +1943,11 @@ void lchain_qgen_mcopy_fast(Candidates_list* cl, overlap_region_alloc* ol, uint3
}
cl->length = m;

// fprintf(stderr, "[M::%s::] rn::%lu\tmax_n_chain::%lu\n", __func__, ol->length, max_n_chain);
// for (k = 0; k < ol->length; k++) {
// fprintf(stderr, "---[M::%s::utg%.6dl] q[%d, %d), t[%d, %d), khit_off::%u\n", __func__,
// (int32_t)ol->list[k].y_id+1, ol->list[k].x_pos_s, ol->list[k].x_pos_e+1,
// ol->list[k].y_pos_s, ol->list[k].y_pos_e+1, ol->list[k].non_homopolymer_errors);
// fprintf(stderr, "---[M::%s::%.*s(qid::%u)] q[%d, %d), t[%d, %d), khit_off::%u\n", __func__,
// (int32_t)Get_NAME_LENGTH(R_INF, ol->list[k].y_id), Get_NAME(R_INF, ol->list[k].y_id), ol->list[k].y_id,
// ol->list[k].x_pos_s, ol->list[k].x_pos_e+1, ol->list[k].y_pos_s, ol->list[k].y_pos_e+1, ol->list[k].non_homopolymer_errors);
// }

k = ol->length;
Expand Down
11 changes: 9 additions & 2 deletions ecovlp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3220,7 +3220,7 @@ static void worker_hap_ec(void *data, long i, int tid)
// if(i != 1124) return;
// if(i != 700) return;
// if(i != 2243244) return;
// if(i != 19350) return;
// if(i != 15139) return;

// debug_retrive_bqual(D, &b->v8t, i, 256); return;

Expand All @@ -3233,6 +3233,8 @@ static void worker_hap_ec(void *data, long i, int tid)

aux_o = fetch_aux_ovlp(&b->olist);///must be here

// stderr_phase_ovlp(&b->olist);

///debug for memory
// snprintf(NULL, 0, "dwn::%u\tdcn::%u", (uint32_t)aux_o->w_list.n, (uint32_t)aux_o->w_list.c.n);

Expand Down Expand Up @@ -4849,7 +4851,12 @@ void h_ec_lchain_fast_new(ha_abuf_t *ab, uint32_t rid, UC_Read *qu, UC_Read *tu,
oa = in0->buffer; on = in0->length;
for (k = 0; k < on; k++) {
if(oa[k].el) {
z = &(ol->list[ol->length++]);
// z = &(ol->list[ol->length++]);
kv_pushp_ol(overlap_region, (*ol), &z);
clear_fake_cigar(&(z->f_cigar));
clear_window_list_alloc(&(z->w_list));
clear_window_list_alloc(&(z->boundary_cigars));

z->x_id = rid; z->y_id = oa[k].tn;
z->x_pos_strand = 0; z->y_pos_strand = oa[k].rev;
z->x_pos_s = (uint32_t)oa[k].qns;
Expand Down

0 comments on commit 184eb0a

Please sign in to comment.