Skip to content

Commit 34eb97a

Browse files
authored
Merge pull request #218 from jerebertho/memory_leak_mulmat
2 parents 7f78550 + 3ffcfad commit 34eb97a

File tree

10 files changed

+88
-95
lines changed

10 files changed

+88
-95
lines changed

src/msolve/hilbert.c

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1765,8 +1765,7 @@ build_matrixn_colon(int32_t *lmb, long dquot, int32_t bld,
17651765
exps[(count_not_lm + i*suppsize+j)*nv+nv-1]=bht->ev[hm[j]][evi[nv-1]];
17661766
}
17671767
}
1768-
tbr = initialize_basis(st);
1769-
tbr->ht = bht;
1768+
tbr = initialize_basis(st, bht);
17701769
#if REDUCTION_ALLINONE
17711770
import_input_data(tbr, st, 0, tobereduced, lens, exps, (void *)cfs, NULL);
17721771
tbr->ld = tbr->lml = tobereduced;
@@ -2000,8 +1999,7 @@ build_matrixn_colon(int32_t *lmb, long dquot, int32_t bld,
20001999
tbr, bht, evi, st, nv, maxdeg);
20012000
}
20022001
#else /* the shifts of phi are now reduced */
2003-
tbr = initialize_basis(st);
2004-
tbr->ht = bht;
2002+
tbr = initialize_basis(st, bht);
20052003
import_input_data(tbr, st, count_not_lm, tobereduced, lens, exps, (void *)cfs, NULL);
20062004
tbr->ld = tbr->lml = 2*nv-2;
20072005
/* printf ("%d imported\n",2*nv-2); */
@@ -2215,8 +2213,7 @@ build_matrixn_colon_no_zero(int32_t *lmb, long dquot, int32_t bld,
22152213
exps[(count_not_lm + i*suppsize+j)*nv+nv-1]=bht->ev[hm[j]][evi[nv-1]];
22162214
}
22172215
}
2218-
tbr = initialize_basis(st);
2219-
tbr->ht = bht;
2216+
tbr = initialize_basis(st, bht);
22202217
import_input_data(tbr, st, 0, tobereduced, lens, exps, (void *)cfs, NULL);
22212218
tbr->ld = tbr->lml = tobereduced;
22222219
/* printf ("%ld imported\n",tobereduced); */
@@ -2859,7 +2856,7 @@ static inline sp_matfglm_t * build_matrixn_from_bs(int32_t *lmb, long dquot,
28592856
static inline void compute_modular_matrix(sp_matfglm_t *matrix,
28602857
trace_det_fglm_mat_t trace_det,
28612858
uint32_t prime){
2862-
uint32_t len_xn = matrix->nrows;
2859+
uint32_t len_xn = matrix->nrows;
28632860
uint32_t dquot = matrix->ncols;
28642861
matrix->charac = prime;
28652862
int32_t len2 = dquot - matrix->nrows;
@@ -2925,7 +2922,7 @@ static inline void build_matrixn_from_bs_trace_application(sp_matfglm_t *matrix,
29252922
const int nv,
29262923
const long fc){
29272924

2928-
uint32_t len_xn = matrix->nrows;
2925+
uint32_t len_xn = matrix->nrows;
29292926
matrix->charac = fc;
29302927
uint64_t len1 = dquot * matrix->nrows;
29312928
int32_t len2 = dquot - matrix->nrows;
@@ -3078,9 +3075,8 @@ static inline void build_matrixn_unstable_from_bs_trace_application(sp_matfglm_t
30783075
long count_not_lm = matrix->nnfs;
30793076
if (count_not_lm) {
30803077
md_t *md = copy_meta_data(st,fc);
3081-
tbr = initialize_basis(md);
3078+
tbr = initialize_basis(md, ht);
30823079
exp_t *mul = (exp_t *)calloc(ht->evl, sizeof(exp_t));
3083-
tbr->ht = ht;
30843080
/* reduction */
30853081
import_input_data(tbr, md, 0, count_not_lm, lens_extra_nf, exps_extra_nf,
30863082
(void *)cfs_extra_nf, NULL);
@@ -3260,6 +3256,7 @@ static inline void build_matrixn_unstable_from_bs_trace_application(sp_matfglm_t
32603256
if (count_not_lm) {
32613257
free_basis_without_hash_table(&tbr);
32623258
}
3259+
free(evi);
32633260
/* if(st->info_level){ */
32643261
/* fprintf(stderr, "[%lu, %lu], Free / Dense = %.2f%%\n", */
32653262
/* len0, len_xn, */
@@ -3646,12 +3643,11 @@ static inline sp_matfglm_t * build_matrixn_unstable_from_bs_trace(int32_t **bdiv
36463643
exps_extra_nf[i*nv+nv-1]=lmb[j*nv+nv-1]+1;
36473644
cfs_extra_nf[i]=1;
36483645
}
3649-
bs_t* tbr;
3646+
bs_t *tbr;
36503647
if (count_not_lm) {
3651-
md_t* md = copy_meta_data(st,fc);
3652-
tbr = initialize_basis(md);
3648+
md_t *md = copy_meta_data(st,fc);
3649+
tbr = initialize_basis(md, ht);
36533650
exp_t *mul = (exp_t *)calloc(bs->ht->evl, sizeof(exp_t));
3654-
tbr->ht = ht;
36553651
/* reduction */
36563652
import_input_data(tbr, md, 0, count_not_lm, lens_extra_nf, exps_extra_nf,
36573653
(void *)cfs_extra_nf, NULL);
@@ -3851,6 +3847,7 @@ static inline sp_matfglm_t * build_matrixn_unstable_from_bs_trace(int32_t **bdiv
38513847
free(len_gb_xn);
38523848
free(start_cf_gb_xn);
38533849
free(div_xn);
3850+
free(evi);
38543851
return NULL;
38553852
}
38563853
}
@@ -3879,6 +3876,7 @@ static inline sp_matfglm_t * build_matrixn_unstable_from_bs_trace(int32_t **bdiv
38793876
"multiplication matrix ");
38803877
fprintf (stdout,"%15.2f | %-13.2f\n",rt_fglm,crt_fglm);
38813878
}
3879+
free(evi);
38823880
return matrix;
38833881
}
38843882

0 commit comments

Comments
 (0)