IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Mar 18, 2010, 3:59:38 PM (16 years ago)
Author:
Paul Price
Message:

Being more careful to free unused memory, to keep memory footprint as low as possible.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/ppStack/src/ppStackLoop.c

    r27319 r27343  
    128128    psLogMsg("ppStack", PS_LOG_INFO, "Stage 3: Make Initial Stack: %f sec", psTimerClear("PPSTACK_STEPS"));
    129129
     130    // Done with stack inputs for now
     131    for (int i = 0; i < options->num; i++) {
     132        pmCellFreeData(options->cells->data[i]);
     133    }
     134    psFree(stack);
    130135
    131136    // Pixel rejection
     
    147152    }
    148153
     154    stack = ppStackThreadDataSetup(options, config, true);
     155    if (!stack) {
     156        psError(psErrorCodeLast(), false, "Unable to initialise stack threads.");
     157        return false;
     158    }
     159
    149160    // Final combination
    150161    psTrace("ppStack", 2, "Final stack of convolved images....\n");
     
    158169    ppStackMemDump("final");
    159170
     171    // Photometry
     172    psTrace("ppStack", 1, "Photometering stacked image....\n");
     173    if (!ppStackPhotometry(options, config)) {
     174        psError(psErrorCodeLast(), false, "Unable to perform photometry.");
     175        return false;
     176    }
     177    psLogMsg("ppStack", PS_LOG_INFO, "Stage 6: Photometry Analysis: %f sec", psTimerClear("PPSTACK_STEPS"));
     178    ppStackMemDump("photometry");
     179
    160180    // Clean up
    161181    psTrace("ppStack", 2, "Cleaning up after combination....\n");
     
    165185        return false;
    166186    }
    167 
    168     // Photometry
    169     psTrace("ppStack", 1, "Photometering stacked image....\n");
    170     if (!ppStackPhotometry(options, config)) {
    171         psError(psErrorCodeLast(), false, "Unable to perform photometry.");
    172         return false;
    173     }
    174     psLogMsg("ppStack", PS_LOG_INFO, "Stage 6: Photometry Analysis: %f sec", psTimerClear("PPSTACK_STEPS"));
    175     ppStackMemDump("photometry");
    176 
    177     if (!ppStackFilesIterateUp(config)) {
    178         psError(psErrorCodeLast(), false, "Unable to close files.");
    179         return false;
    180     }
    181     ppStackFileActivation(config, PPSTACK_FILES_STACK, false);
    182     ppStackFileActivation(config, PPSTACK_FILES_PHOT, false);
    183     options->outRO->data_exists = false;
    184     options->outRO->parent->data_exists = false;
    185     options->outRO->parent->parent->data_exists = false;
    186     psFree(options->outRO);
    187     options->outRO = NULL;
    188 
     187    for (int i = 0; i < options->num; i++) {
     188        pmCellFreeData(options->cells->data[i]);
     189    }
     190    psFree(stack);
    189191    psLogMsg("ppStack", PS_LOG_INFO, "Stage 7: Cleanup, WCS & JPEGS: %f sec", psTimerClear("PPSTACK_STEPS"));
    190192    ppStackMemDump("cleanup");
    191 
    192     psFree(stack);
    193193
    194194#if 1
     
    232232        options->unconvRO = NULL;
    233233
     234        for (int i = 0; i < options->num; i++) {
     235            pmCellFreeData(options->cells->data[i]);
     236        }
    234237        psFree(stack);
    235238    }
Note: See TracChangeset for help on using the changeset viewer.