IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 19475


Ignore:
Timestamp:
Sep 10, 2008, 2:59:24 PM (18 years ago)
Author:
Paul Price
Message:

Got '* glibc detected * ppStack: double free or corruption (): 0x00007f743f3f9190 *' mentioning pmConceptsAverageCells. Suspect that there's some memory corruption going on by calling pmConceptsAverageCells multiple times within threads. Moved it out of the stacking into ppStackLoop.

Location:
trunk/ppStack/src
Files:
3 edited

Legend:

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

    r19411 r19475  
    771771    }
    772772
     773    psThreadPoolFinalize();
     774
    773775    memDump("final");
    774776
     
    786788    // Close up
    787789    bool wcsDone = false;           // Have we done the WCS?
     790    psList *fpaList = psListAlloc(NULL); // List of input FPAs, for concept averaging
     791    psList *cellList = psListAlloc(NULL); // List of input cells, for concept averaging
     792    float totExposure = 0.0;            // Total exposure time
    788793    for (int i = 0; i < num; i++) {
    789794        if (!inputMask->data.U8[i]) {
    790795            continue;
    791796        }
     797        ppStackThread *thread = stack->threads->data[0]; // Representative stack
     798        pmReadout *inRO = thread->readouts->data[i]; // Template readout
     799        if (!inRO) {
     800            continue;
     801        }
     802        float exposure = psMetadataLookupF32(NULL, inRO->parent->concepts, "CELL.EXPOSURE"); // Exposure time
     803        if (!isfinite(exposure)) {
     804            psWarning("CELL.EXPOSURE not set for readout %d", i);
     805        } else {
     806            totExposure += exposure;
     807        }
     808
     809        psListAdd(cellList, PS_LIST_TAIL, inRO->parent);
     810        psListAdd(fpaList, PS_LIST_TAIL, inRO->parent->parent->parent);
     811
    792812        if (!wcsDone) {
    793813            // Copy astrometry over
    794814            wcsDone = true;
    795             ppStackThread *thread = stack->threads->data[0]; // Representative stack
    796             pmReadout *inRO = thread->readouts->data[i]; // Template readout
    797815            if (inRO) {
    798816                pmHDU *inHDU = pmHDUFromCell(inRO->parent); // Template HDU
     
    838856    psFree(weightNames);
    839857
     858    // Copy concepts
     859    pmCell *outCell = outRO->parent;    // Output cell
     860    pmChip *outChip = outCell->parent;  // Output chip
     861    pmFPA *outFPA = outChip->parent;    // Output FPA
     862    psMetadataAddF32(outCell->concepts, PS_LIST_TAIL, "CELL.EXPOSURE", PS_META_REPLACE,
     863                     "Summed exposure time (sec)", totExposure);
     864    psMetadataAddF32(outFPA->concepts, PS_LIST_TAIL, "FPA.EXPOSURE", PS_META_REPLACE,
     865                     "Summed exposure time (sec)", totExposure);
     866
     867    pmConceptsAverageFPAs(outFPA, fpaList);
     868    pmConceptsAverageCells(outCell, cellList, NULL, NULL, true);
     869    psFree(fpaList);
     870    psFree(cellList);
     871
    840872    psFree(inputMask);
    841873    psFree(stack);
  • trunk/ppStack/src/ppStackMatch.c

    r19453 r19475  
    1515                     PM_SOURCE_MODE_CR_LIMIT) // Mask to apply to input sources
    1616
    17 //#define TESTING                         // Enable debugging output
     17#define TESTING                         // Enable debugging output
    1818
    1919
  • trunk/ppStack/src/ppStackReadout.c

    r19346 r19475  
    196196    psArray *stack = psArrayAlloc(num); // Array for stacking
    197197
    198     pmCell *outCell = outRO->parent;    // Output cell
    199     pmChip *outChip = outCell->parent;  // Output chip
    200     pmFPA *outFPA = outChip->parent;    // Output FPA
    201 
    202     float totExposure = 0.0;            // Total exposure time
    203     psList *fpaList = psListAlloc(NULL); // List of input FPAs, for concept averaging
    204     psList *cellList = psListAlloc(NULL); // List of input cells, for concept averaging
    205198    int numGood = num;                  // Number of good inputs: images that haven't been completely rejected
    206199    for (int i = 0; i < num; i++) {
     
    222215        }
    223216
    224         float exposure = psMetadataLookupF32(NULL, ro->parent->concepts, "CELL.EXPOSURE"); // Exposure time
    225         if (!isfinite(exposure)) {
    226             psError(PS_ERR_BAD_PARAMETER_VALUE, true,
    227                     "CELL.EXPOSURE is not set for input file %ld", stack->n);
    228             psFree(fpaList);
    229             psFree(cellList);
    230             psFree(stack);
    231             return false;
    232         }
    233         totExposure += exposure;        // Total exposure time
    234 
    235217        // Ensure there is a mask, or pmStackCombine will complain
    236218        if (!ro->mask) {
     
    239221        }
    240222
    241         psListAdd(fpaList, PS_LIST_TAIL, fpa);
    242         psListAdd(cellList, PS_LIST_TAIL, ro->parent);
    243 
    244223        pmStackData *data = pmStackDataAlloc(ro, weighting);
    245224        data->reject = psMemIncrRefCounter(rejected->data[i]);
     
    250229                        numGood != num, useVariance, false)) {
    251230        psError(PS_ERR_UNKNOWN, false, "Unable to combine input readouts.");
    252         psFree(fpaList);
    253         psFree(cellList);
    254231        psFree(stack);
    255232        return false;
     
    267244#endif
    268245
    269     psMetadataAddF32(outCell->concepts, PS_LIST_TAIL, "CELL.EXPOSURE", PS_META_REPLACE,
    270                      "Summed exposure time (sec)", totExposure);
    271     psMetadataAddF32(outCell->parent->parent->concepts, PS_LIST_TAIL, "FPA.EXPOSURE", PS_META_REPLACE,
    272                      "Summed exposure time (sec)", totExposure);
     246    pmCell *outCell = outRO->parent;    // Output cell
     247    pmChip *outChip = outCell->parent;  // Output chip
    273248
    274249    outRO->data_exists = true;
    275250    outCell->data_exists = true;
    276     outCell->parent->data_exists = true;
    277 
    278     // Copy other concepts
    279     pmConceptsAverageFPAs(outFPA, fpaList);
    280     pmConceptsAverageCells(outCell, cellList, NULL, NULL, true);
    281     psFree(fpaList);
    282     psFree(cellList);
     251    outChip->data_exists = true;
    283252
    284253    psFree(stack);
Note: See TracChangeset for help on using the changeset viewer.