IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Jan 21, 2025, 11:05:48 AM (16 months ago)
Author:
tdeboer
Message:

ppMerge memory leak, ppMerge changes

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/ppMerge/src/ppMergeFiles.c

    r33666 r42785  
    105105}
    106106
    107 psArray *ppMergeFileDataLevel(const pmConfig *config, const char *name, pmFPALevel level)
     107bool ppMergeFileFreeInput(pmConfig *config, const pmFPAview *view, int num)
     108{
     109    {
     110        pmFPAfile *input = pmFPAfileSelectSingle(config->files, "PPMERGE.INPUT", num);
     111        if (!pmFPAfileFreeData(input, view)) {
     112            psError(PS_ERR_UNKNOWN, false, "Unable to free data for image file %d", num);
     113            return false;
     114        }
     115    }
     116    bool mdok;          // Status of MD lookup
     117    if (psMetadataLookupBool(&mdok, config->arguments, "INPUTS.MASKS")) {
     118        pmFPAfile *mask = pmFPAfileSelectSingle(config->files, "PPMERGE.INPUT.MASK", num); // Mask file
     119        if (!pmFPAfileFreeData(mask, view)) {
     120            psError(PS_ERR_UNKNOWN, false, "Unable to free data for mask file %d", num);
     121            return false;
     122        }
     123    }
     124    if (psMetadataLookupBool(&mdok, config->arguments, "INPUTS.VARIANCES")) {
     125        pmFPAfile *variance = pmFPAfileSelectSingle(config->files, "PPMERGE.INPUT.VARIANCE", num); // Variance file
     126        if (!pmFPAfileFreeData(variance, view)) {
     127            psError(PS_ERR_UNKNOWN, false, "Unable to free data for variance file %d", num);
     128            return false;
     129        }
     130    }
     131    return true;
     132}
     133
     134// Select the specified input files and assign the dataLevel and freeLevel,
     135// saving a pointer on output array.
     136// This function takes the argument pmFPALevel and sets the dataLevel based on that value.
     137// However, this is only used with the value PM_FPA_LEVEL_READOUT, and it must be set
     138// to that level for the rest of ppMerge to work correctly.  Furthermore, the freeLevel
     139// must be set to Cell.  Remove the (false) option.
     140psArray *ppMergeFileDataLevel(const pmConfig *config, const char *name)
    108141{
    109142    assert(config);
     
    115148    for (int i = 0; i < numFiles; i++) {
    116149        pmFPAfile *file = pmFPAfileSelectSingle(config->files, name, i); // Image file
    117         file->dataLevel = level;
    118         file->freeLevel = level;
     150        file->dataLevel = PM_FPA_LEVEL_READOUT;
     151        file->freeLevel = PM_FPA_LEVEL_CELL;
    119152        files->data[i] = psMemIncrRefCounter(file);
    120153    }
Note: See TracChangeset for help on using the changeset viewer.