Trisurf Monte Carlo simulator
Samo Penic
2016-05-18 7010269f3bc74c764f5b4e9c72dd069ce34fb244
Fix in memory leak. There were also leaks in the old code probably.
3 files modified
17 ■■■■ changed files
src/shcomplex.c 2 ●●● patch | view | raw | blame | history
src/tsmeasure.c 14 ●●●● patch | view | raw | blame | history
src/vesicle.c 1 ●●●● patch | view | raw | blame | history
src/shcomplex.c
@@ -69,7 +69,7 @@
    if(sph->co != NULL) free(sph->co);
    if(sph->ulm !=NULL) free(sph->ulm);
    if(sph->ulmComplex !=NULL) free(sph->ulmComplex);
    if(sph->sumUlm2 !=NULL) free(sph->sumUlm2);
        if(sph->Ylmi!=NULL) {
            for(i=0;i<sph->l;i++){
                if(sph->Ylmi[i]!=NULL){
src/tsmeasure.c
@@ -34,9 +34,9 @@
}
void vesicle_calculate_ulm2(ts_vesicle *vesicle){
    complex_sph_free(vesicle->sphHarmonics);
    //complex_sph_free(vesicle->sphHarmonics);
    vesicle->sphHarmonics=complex_sph_init(vesicle->vlist,21);
    //vesicle->sphHarmonics=complex_sph_init(vesicle->vlist,21);
    vesicle_volume(vesicle);
    preparationSh(vesicle,getR0(vesicle));
    calculateUlmComplex(vesicle);
@@ -68,7 +68,7 @@
        ent=list[n];    
                i=rindex(ent->d_name,'.');
                if(i==NULL) {
            continue;
                continue;
        }
                if(strcmp(i+1,"vtu")==0){
                    j=rindex(ent->d_name,'_');
@@ -78,14 +78,20 @@
                    ts_fprintf(stdout,"timestep: %u filename: %s\n",atoi(number),ent->d_name);
            printf("%u ",atoi(number));
            vesicle=restoreVesicle(ent->d_name);
            vesicle_calculate_ulm2(vesicle);
//            vesicle_calculate_ulm2(vesicle);
                        tstep++;
            //vesicle_free(vesicle);
                    free(number);
            tape_free(vesicle->tape);
            vesicle_free(vesicle);
                }
        free(ent);  
        }
    for (n = 0; n < count; n++)
      {
          free(list[n]);
      }
    free(list);
    return 0;
}
src/vesicle.c
@@ -38,6 +38,7 @@
    triangle_list_free(vesicle->tlist);
    cell_list_free(vesicle->clist);
    poly_list_free(vesicle->poly_list);
    poly_list_free(vesicle->filament_list);
    complex_sph_free(vesicle->sphHarmonics);
    free(vesicle);
    return TS_SUCCESS;