IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Mar 13, 2008, 2:29:14 PM (18 years ago)
Author:
Paul Price
Message:

Fix for outrageous use of memory when combining GPC images --- there are so many chips and cells, each with their own concepts metadata, that the memory is filled with metadataItems. Added a purge of the ones that aren't required. Since the concepts are integral to the system, it's sometimes necessary when iterating to skip cells that have had the concepts purged.

File:
1 edited

Legend:

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

    r13246 r16989  
    106106        }
    107107
    108         data->in->data[i] = pmFPAConstruct(config->camera);
    109         pmFPAview *view = pmFPAAddSourceFromHeader(data->in->data[i], header, options->format);
     108        pmFPA *fpa = pmFPAConstruct(config->camera);
     109        pmFPAview *view = pmFPAAddSourceFromHeader(fpa, header, options->format);
    110110        psFree(view);
     111
     112        // Cull chips and cells that don't have data
     113        // Otherwise the abundance of metadata in the concepts (esp. for GPC) can overload the memory
     114        psArray *chips = fpa->chips; // Array of chips in output
     115        for (int i = 0; i < chips->n; i++) {
     116            pmChip *chip = chips->data[i]; // Chip of interest
     117            psArray *cells = chip->cells; // Array of cells
     118            int culled = 0;             // Number of culled cells
     119            for (int j = 0; j < cells->n; j++) {
     120                pmCell *cell = cells->data[j];
     121                pmHDU *hdu = pmHDUGetLowest(fpa, chip, cell); // HDU for cell
     122                if (!hdu || hdu->blankPHU) {
     123                    psFree(cell->concepts);
     124                    cell->concepts = NULL;
     125                    culled++;
     126                }
     127            }
     128            if (culled == cells->n) {
     129                psFree(chip->concepts);
     130                chip->concepts = NULL;
     131            }
     132        }
     133        data->in->data[i] = fpa;
     134
    111135
    112136        // Use the first valid input as the basis for the output --- including the header
Note: See TracChangeset for help on using the changeset viewer.