IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

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.

File:
1 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);
Note: See TracChangeset for help on using the changeset viewer.