IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Feb 7, 2006, 8:52:03 PM (20 years ago)
Author:
eugene
Message:

extensive cleanup of memory handling : no more leaks!

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/psphot/src/psphotEnsemblePSF.c

    r6056 r6379  
    11# include "psphot.h"
    22
     3// 2006.02.07 : no leaks!
     4// fit all reasonable sources with the linear PSF model
    35bool psphotEnsemblePSF (pmReadout *readout, psMetadata *config, psArray *sources, pmPSF *psf, psStats *sky) {
    46
     
    68    float x;
    79    float y;
     10    float f;
    811
    912    psTimerStart ("psphot");
     
    2831    bool UseAnalysisRegion = false;
    2932    psRegion AnalysisRegion = {0, 0, 0, 0};
    30     char *region = psMetadataLookupPtr (&status, config, "ANALYSIS_REGION");
     33    char *region = psMetadataLookupStr (&status, config, "ANALYSIS_REGION");
    3134    if (status) {
    3235        UseAnalysisRegion = true;
     
    126129        index->data.U32[models->n] = i;
    127130        psArrayAdd (models, 100, otSource);
     131        psFree (otSource);
    128132    }
    129133    psLogMsg ("psphot.emsemble", 4, "built models: %f (%d objects)\n", psTimerMark ("psphot"), sources->n);
    130134   
    131     float f;
    132 
    133135    // fill out the sparse matrix
    134136    psSparse *sparse = psSparseAlloc (models->n, 100);
     
    173175        pmSource *Mi = models->data[i];
    174176
    175         Fi->modelPSF = Mi->modelPSF;
     177        // need to increment counter so we can free models here and sources above
     178        Fi->modelPSF = psMemCopy (Mi->modelPSF);
    176179
    177180        // assign linearly-fitted normalization
     
    183186        Fi->mode |= PM_SOURCE_TEMPSUB;
    184187    }
    185 
    186     // XXX EAM : need to free up many things here
     188    psFree (index);
     189    psFree (sparse);
     190    psFree (models);
     191    psFree (norm);
    187192
    188193    psLogMsg ("psphot.emsemble", 3, "measure ensemble of PSFs: %f sec\n", psTimerMark ("psphot"));
Note: See TracChangeset for help on using the changeset viewer.