void free_updategenealogy (void) { free_genealogy_weights (&holdallgweight_updategenealogy); free_genealogy_weights (&holdgweight_updategenealogy); free_probcalc (&holdallpcalc_updategenealogy); } //free_updategenealogy
void free_t_RY (void) { int li; free_genealogy_weights (&holdallgweight_t_RY); for (li = 0; li < nloci; li++) { free_genealogy_weights (&holdgweight_t_RY[li]); } free_probcalc (&holdallpcalc_t_RY); orig2d_free2D ((void **) skipflag, nloci); } // free_changet_RY
void freeanymemory () { int ci; int i; int j; int li; int npnodes; int nperiods; unsetseeds (); if (assignmentoptions[POPULATIONASSIGNMENTINFINITE] == 1) { npnodes = npops + 1; nperiods = 2; } else if (modeloptions[SINGLEPOPULATION] == 1) { npnodes = 1; nperiods = 1; } else { npnodes = 2 * npops - 1; nperiods = npops; for (i = 0; i < lastperiodnumber; i++) { free_value_record (T[i].v); } } if (assignmentoptions[POPULATIONASSIGNMENT] == 1) { free_a_rec_multichain (); } for (ci = 0; ci < numchains; ci++) { for (i = 0; i < npnodes; i++) { free (C[ci]->poptree[i].up); C[ci]->poptree[i].up = NULL; } XFREE (C[ci]->tvals); XFREE (C[ci]->poptree); free_genealogy_weights (&(C[ci]->allgweight)); free_probcalc (&(C[ci]->allpcalc)); if (C[ci]->plist != NULL) { for (j = 0; j < nperiods; j++) { XFREE (C[ci]->plist[j]); } XFREE (C[ci]->plist); } for (li = 0; li < nloci; li++) { free_genealogy_weights (&(C[ci]->G[li].gweight)); XFREE (C[ci]->G[li].uvals); XFREE (C[ci]->G[li].pdg_a); if (L[li].model == HKY) { XFREE (L[li].mult); for (i = L[li].numgenes; i < 2 * L[li].numgenes - 1; i++) { XFREE (C[ci]->G[li].gtree[i].hkyi.scalefactor); XFREE (C[ci]->G[li].gtree[i].hkyi.oldscalefactor); for (j = 0; j < L[li].numsites; j++) { XFREE (C[ci]->G[li].gtree[i].hkyi.frac[j]); XFREE (C[ci]->G[li].gtree[i].hkyi.newfrac[j]); } XFREE (C[ci]->G[li].gtree[i].hkyi.frac); XFREE (C[ci]->G[li].gtree[i].hkyi.newfrac); } } for (i = 0; i < L[li].numlines; i++) { XFREE (C[ci]->G[li].gtree[i].mig); if (L[li].model == STEPWISE || L[li].model == JOINT_IS_SW) { XFREE (C[ci]->G[li].gtree[i].A); XFREE (C[ci]->G[li].gtree[i].dlikeA); } if (L[li].model == INFINITESITES) { XFREE (C[ci]->G[li].gtree[i].seq); } } XFREE (C[ci]->G[li].gtree); XFREE (C[ci]->G[li].mut); } XFREE (C[ci]->G); XFREE (C[ci]); } free_locus (); /* L is the global: global variable is too simple. */ /*JH 1/6/09 this will get deleted with these mig values are restored to a large array instead of pointers */ XFREE (oldedgemig.mtimeavail); XFREE (oldedgemig.mp); XFREE (oldsismig.mtimeavail); XFREE (oldsismig.mp); XFREE (newedgemig.mtimeavail); XFREE (newedgemig.mp); XFREE (newsismig.mtimeavail); XFREE (newsismig.mp); XFREE (C); free_iparam (itheta, numpopsizeparams, 0); free_iparam (imig, nummigrateparams, 1); free_iparam (&isplit, 1, -1); itheta = NULL; if (npops > 2 && npops < 5 && outputoptions[PRINTJOINTTEST]) free_multi_t_arrays (); if (assignmentoptions[POPULATIONASSIGNMENTINFINITE] == 0 && modeloptions[SINGLEPOPULATION] == 0) { free_t_NW (); free_t_RY (); } free_updategenealogy (); free_updategenealogy_covar (); free_treeweight (); free_gtreecommon (); free_sumlogk (); for (i = 0; i < nomigrationchecklist.n; i++) { XFREE (nomigrationchecklist.p); XFREE (nomigrationchecklist.r); XFREE (nomigrationchecklist.c); } if (assignmentoptions[POPULATIONASSIGNMENTINFINITE] == 1 || modeloptions[SINGLEPOPULATION] == 1) { /* no split time */ } else { free_T (); } free_lpgpd_v (lpgpd_v); if (outputoptions[MIGRATEHIST]) free_migration_counts_times (migration_counts_times); free_autoc_pointers (); XFREE (L); return; } //freeanymemory