Changeset 6342
- Timestamp:
- Feb 7, 2006, 11:18:31 AM (20 years ago)
- Location:
- branches/eam_rel9_p0/psModules/src/astrom
- Files:
-
- 4 edited
-
pmChipMosaic.c (modified) (6 diffs)
-
pmConcepts.c (modified) (13 diffs)
-
pmFPA.c (modified) (14 diffs)
-
pmFPAConstruct.c (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_rel9_p0/psModules/src/astrom/pmChipMosaic.c
r6145 r6342 6 6 #include "pmChipMosaic.h" 7 7 8 #define MEM_LEAKS 18 #define MEM_LEAKS 0 9 9 10 10 // Compare a value with a maximum and minimum … … 156 156 continue; 157 157 } 158 159 psMetadataPrint(cell->concepts, 10); 160 158 161 nCells++; 159 162 gain += psMetadataLookupF32(NULL, cell->concepts, "CELL.GAIN"); … … 266 269 267 270 // The images to put into the mosaic 268 images->data[i] = readout->image;269 weights->data[i] = readout->weight;270 masks->data[i] = readout->mask;271 images->data[i] = psMemIncrRefCounter(readout->image); 272 weights->data[i] = psMemIncrRefCounter(readout->weight); 273 masks->data[i] = psMemIncrRefCounter(readout->mask); 271 274 } 272 275 // Mosaic the images together and we're done … … 311 314 312 315 // Chop off all the component cells, and put in a new one 313 #if ndefMEM_LEAKS316 #if !MEM_LEAKS 314 317 pmChipFreeCells(chip); 315 318 #else … … 321 324 cellConcepts(cell, cells, xBinChip, yBinChip); 322 325 323 #if 1326 #if 0 324 327 // XXX For the sake of getting something working, I am not going to bother with sorting out where 325 328 // the double free is coming from. I'm going to drop the pointers on the array and create a memory 326 329 // leak. We can clean this up later, when we're not under as much pressure. 327 #else328 329 330 psArrayElementsFree(chip->cells); 330 331 chip->cells->n = 0; … … 337 338 // Want the readouts to contain a subimage, but that subimage is the whole image. 338 339 // This preserves the relationship there was before, where freeing the parent frees the child. 339 readout->image = ps MemIncrRefCounter(psImageSubset(image, entire));340 readout->weight = ps MemIncrRefCounter(psImageSubset(weight, entire));341 readout->mask = ps MemIncrRefCounter(psImageSubset(mask, entire));340 readout->image = psImageSubset(image, entire); 341 readout->weight = psImageSubset(weight, entire); 342 readout->mask = psImageSubset(mask, entire); 342 343 psFree(readout); 343 344 -
branches/eam_rel9_p0/psModules/src/astrom/pmConcepts.c
r6124 r6342 11 11 #include "psAdditionals.h" 12 12 13 static bool conceptsInitialised = false;// Have concepts been read? 13 14 static psMetadata *conceptsFPA = NULL; // Known concepts for FPA 14 15 static psMetadata *conceptsChip = NULL; // Known concepts for chip … … 29 30 psMemSetDeallocator(spec, (psFreeFunc)conceptSpecFree); 30 31 31 spec->blank = blank;32 spec->blank = psMemIncrRefCounter(blank); 32 33 spec->read = read; 33 34 spec->write = write; … … 44 45 { 45 46 assert(blank); 46 pmConceptsInit(); 47 if (!conceptsInitialised) { 48 pmConceptsInit(); 49 } 47 50 48 51 pmConceptSpec *spec = pmConceptSpecAlloc(blank, read, write); // The concept specification … … 66 69 psMetadataAdd(*target, PS_LIST_TAIL, blank->name, PS_DATA_UNKNOWN | PS_META_REPLACE, 67 70 "Concepts specification", spec); 71 psFree(spec); // Drop reference 68 72 69 73 return true; … … 105 109 ) 106 110 { 107 pmConceptsInit(); 111 if (!conceptsInitialised) { 112 pmConceptsInit(); 113 } 108 114 psMetadataIterator *specsIter = psMetadataIteratorAlloc(*specs, PS_LIST_HEAD, NULL); // Iterator on specs 109 115 psMetadataItem *specItem = NULL; // Item from the specs metadata 110 116 while ((specItem = psMetadataGetAndIncrement(specsIter))) { 117 psTrace(__func__, 9, "Blanking %s...\n", specItem->name); 111 118 pmConceptSpec *spec = specItem->data.V; // The specification 112 119 psMetadataItem *blank = spec->blank; // The concept … … 127 134 ) 128 135 { 129 pmConceptsInit(); 136 if (!conceptsInitialised) { 137 pmConceptsInit(); 138 } 130 139 psMetadataIterator *specsIter = psMetadataIteratorAlloc(*specs, PS_LIST_HEAD, NULL); // Iterator on specs 131 140 psMetadataItem *specItem = NULL; // Item from the specs metadata … … 157 166 ) 158 167 { 159 pmConceptsInit(); 168 if (!conceptsInitialised) { 169 pmConceptsInit(); 170 } 160 171 if (! fpa->camera) { 161 172 return false; … … 282 293 283 294 // FPA.NAME 284 pmConceptRegister(psMetadataItemAllocStr("FPA.NAME", "Name of FPA", ""), NULL, NULL, 285 PM_CONCEPT_LEVEL_FPA); 295 { 296 psMetadataItem *fpaName = psMetadataItemAllocStr("FPA.NAME", "Name of FPA", ""); 297 pmConceptRegister(fpaName, NULL, NULL, PM_CONCEPT_LEVEL_FPA); 298 psFree(fpaName); 299 } 286 300 287 301 // FPA.AIRMASS 288 pmConceptRegister(psMetadataItemAllocF32("FPA.AIRMASS", "Airmass at boresight", 0.0), NULL, NULL, 289 PM_CONCEPT_LEVEL_FPA); 302 { 303 psMetadataItem *fpaAirmass = psMetadataItemAllocF32("FPA.AIRMASS", "Airmass at boresight", 0.0); 304 pmConceptRegister(fpaAirmass, NULL, NULL, PM_CONCEPT_LEVEL_FPA); 305 psFree(fpaAirmass); 306 } 290 307 291 308 // FPA.FILTER 292 pmConceptRegister(psMetadataItemAllocStr("FPA.FILTER", "Filter used", ""), NULL, NULL, 293 PM_CONCEPT_LEVEL_FPA); 309 { 310 psMetadataItem *fpaFilter = psMetadataItemAllocStr("FPA.FILTER", "Filter used", ""); 311 pmConceptRegister(fpaFilter, NULL, NULL, PM_CONCEPT_LEVEL_FPA); 312 psFree(fpaFilter); 313 } 294 314 295 315 // FPA.POSANGLE 296 pmConceptRegister(psMetadataItemAllocF32("FPA.POSANGLE", "Position angle of instrument", 0.0), NULL, 297 NULL, PM_CONCEPT_LEVEL_FPA); 316 { 317 psMetadataItem *fpaPosangle = psMetadataItemAllocF32("FPA.POSANGLE", 318 "Position angle of instrument", 0.0); 319 pmConceptRegister(fpaPosangle, NULL, NULL, PM_CONCEPT_LEVEL_FPA); 320 psFree(fpaPosangle); 321 } 298 322 299 323 // FPA.RADECSYS 300 pmConceptRegister(psMetadataItemAllocStr("FPA.RADECSYS", "Celestial coordinate system", ""), NULL, 301 NULL, PM_CONCEPT_LEVEL_FPA); 324 { 325 psMetadataItem *fpaRadecsys = psMetadataItemAllocStr("FPA.RADECSYS", 326 "Celestial coordinate system", ""); 327 pmConceptRegister(fpaRadecsys, NULL, NULL, PM_CONCEPT_LEVEL_FPA); 328 psFree(fpaRadecsys); 329 } 302 330 303 331 // FPA.RA 304 pmConceptRegister(psMetadataItemAllocF64("FPA.RA", "Right Ascension of boresight", NAN), 305 (pmConceptReadFunc)pmConceptRead_FPA_RA, (pmConceptWriteFunc)pmConceptWrite_FPA_RA, 306 PM_CONCEPT_LEVEL_FPA); 332 { 333 psMetadataItem *fpaRa = psMetadataItemAllocF64("FPA.RA", "Right Ascension of boresight", NAN); 334 pmConceptRegister(fpaRa, (pmConceptReadFunc)pmConceptRead_FPA_RA, 335 (pmConceptWriteFunc)pmConceptWrite_FPA_RA, PM_CONCEPT_LEVEL_FPA); 336 psFree(fpaRa); 337 } 307 338 308 339 // FPA.DEC 309 pmConceptRegister(psMetadataItemAllocF64("FPA.DEC", "Declination of boresight", NAN), 310 (pmConceptReadFunc)pmConceptRead_FPA_DEC, 311 (pmConceptWriteFunc)pmConceptWrite_FPA_DEC, PM_CONCEPT_LEVEL_FPA); 312 340 { 341 psMetadataItem *fpaDec = psMetadataItemAllocF64("FPA.DEC", "Declination of boresight", NAN); 342 pmConceptRegister(fpaDec, (pmConceptReadFunc)pmConceptRead_FPA_DEC, 343 (pmConceptWriteFunc)pmConceptWrite_FPA_DEC, PM_CONCEPT_LEVEL_FPA); 344 psFree(fpaDec); 345 } 346 347 // Done with FPA level concepts 313 348 } 314 349 if (! conceptsChip) { … … 324 359 325 360 // CELL.GAIN 326 pmConceptRegister(psMetadataItemAllocF32("CELL.GAIN", "CCD gain (e/count)", NAN), NULL, NULL, 327 PM_CONCEPT_LEVEL_CELL); 361 { 362 psMetadataItem *cellGain = psMetadataItemAllocF32("CELL.GAIN", "CCD gain (e/count)", NAN); 363 pmConceptRegister(cellGain, NULL, NULL, PM_CONCEPT_LEVEL_CELL); 364 psFree(cellGain); 365 } 328 366 329 367 // CELL.READNOISE 330 pmConceptRegister(psMetadataItemAllocF32("CELL.GAIN", "CCD read noise (e)", NAN), NULL, NULL, 331 PM_CONCEPT_LEVEL_CELL); 368 { 369 psMetadataItem *cellReadnoise = psMetadataItemAllocF32("CELL.READNOISE", 370 "CCD read noise (e)", NAN); 371 pmConceptRegister(cellReadnoise, NULL, NULL, PM_CONCEPT_LEVEL_CELL); 372 psFree(cellReadnoise); 373 } 332 374 333 375 // CELL.SATURATION 334 pmConceptRegister(psMetadataItemAllocF32("CELL.SATURATION", "Saturation level (counts)", NAN), NULL, 335 NULL, PM_CONCEPT_LEVEL_CELL); 376 { 377 psMetadataItem *cellSaturation = psMetadataItemAllocF32("CELL.SATURATION", 378 "Saturation level (counts)", NAN); 379 pmConceptRegister(cellSaturation, NULL, NULL, PM_CONCEPT_LEVEL_CELL); 380 psFree(cellSaturation); 381 } 336 382 337 383 // CELL.BAD 338 pmConceptRegister(psMetadataItemAllocF32("CELL.BAD", "Bad level (counts)", NAN), NULL, NULL, 339 PM_CONCEPT_LEVEL_CELL); 384 { 385 psMetadataItem *cellBad = psMetadataItemAllocF32("CELL.BAD", "Bad level (counts)", NAN); 386 pmConceptRegister(cellBad, NULL, NULL, PM_CONCEPT_LEVEL_CELL); 387 psFree(cellBad); 388 } 340 389 341 390 // CELL.XPARITY 342 pmConceptRegister(psMetadataItemAllocS32("CELL.XPARITY", 343 "Orientation in x compared to the rest of the FPA", 0), 344 NULL, NULL, PM_CONCEPT_LEVEL_CELL); 391 { 392 psMetadataItem *cellXparity = psMetadataItemAllocS32("CELL.XPARITY", 393 "Orientation in x compared to the rest of the FPA", 0); 394 pmConceptRegister(cellXparity, NULL, NULL, PM_CONCEPT_LEVEL_CELL); 395 psFree(cellXparity); 396 } 345 397 346 398 // CELL.YPARITY 347 pmConceptRegister(psMetadataItemAllocS32("CELL.YPARITY", 348 "Orientation in x compared to the rest of the FPA", 0), 349 NULL, NULL, PM_CONCEPT_LEVEL_CELL); 399 { 400 psMetadataItem *cellYparity = psMetadataItemAllocS32("CELL.YPARITY", 401 "Orientation in x compared to the rest of the FPA", 0); 402 pmConceptRegister(cellYparity, NULL, NULL, PM_CONCEPT_LEVEL_CELL); 403 psFree(cellYparity); 404 } 350 405 351 406 // CELL.READDIR 352 pmConceptRegister(psMetadataItemAllocS32("CELL.READDIR", "Read direction, rows=1, cols=2", 1), NULL, 353 NULL, PM_CONCEPT_LEVEL_CELL); 407 { 408 psMetadataItem *cellReaddir = psMetadataItemAllocS32("CELL.READDIR", 409 "Read direction, rows=1, cols=2", 1); 410 pmConceptRegister(cellReaddir, NULL, NULL, PM_CONCEPT_LEVEL_CELL); 411 psFree(cellReaddir); 412 } 354 413 355 414 … … 361 420 362 421 // CELL.EXPOSURE 363 pmConceptRegister(psMetadataItemAllocF32("CELL.EXPOSURE", "Exposure time (sec)", NAN), NULL, NULL, 364 PM_CONCEPT_LEVEL_CELL); 422 { 423 psMetadataItem *cellExposure = psMetadataItemAllocF32("CELL.EXPOSURE", 424 "Exposure time (sec)", NAN); 425 pmConceptRegister(cellExposure, NULL, NULL, PM_CONCEPT_LEVEL_CELL); 426 psFree(cellExposure); 427 } 365 428 366 429 // CELL.DARKTIME 367 pmConceptRegister(psMetadataItemAllocF32("CELL.DARKTIME", "Time since flush (sec)", NAN), NULL, NULL, 368 PM_CONCEPT_LEVEL_CELL); 430 { 431 psMetadataItem *cellDarktime = psMetadataItemAllocF32("CELL.DARKTIME", 432 "Time since flush (sec)", NAN); 433 pmConceptRegister(cellDarktime, NULL, NULL, PM_CONCEPT_LEVEL_CELL); 434 psFree(cellDarktime); 435 } 369 436 370 437 // CELL.TRIMSEC … … 372 439 psRegion *trimsec = psAlloc(sizeof(psRegion)); // Blank trimsec 373 440 trimsec->x0 = trimsec->y0 = trimsec->x1 = trimsec->y1 = NAN; 374 pmConceptRegister(psMetadataItemAllocPtr("CELL.TRIMSEC", PS_DATA_UNKNOWN, "Trim section", 375 trimsec), 376 (pmConceptReadFunc)pmConceptRead_CELL_TRIMSEC, 441 psMetadataItem *cellTrimsec = psMetadataItemAllocPtr("CELL.TRIMSEC", PS_DATA_UNKNOWN, 442 "Trim section", trimsec); 443 psFree(trimsec); 444 pmConceptRegister(cellTrimsec, (pmConceptReadFunc)pmConceptRead_CELL_TRIMSEC, 377 445 (pmConceptWriteFunc)pmConceptWrite_CELL_TRIMSEC, PM_CONCEPT_LEVEL_CELL); 378 psFree( trimsec);446 psFree(cellTrimsec); 379 447 } 380 448 … … 382 450 { 383 451 psList *biassecs = psListAlloc(NULL); // Blank biassecs 384 pmConceptRegister(psMetadataItemAllocPtr("CELL.BIASSEC", PS_DATA_LIST, "Bias sections", biassecs), 385 (pmConceptReadFunc)pmConceptRead_CELL_BIASSEC, 386 (pmConceptWriteFunc)pmConceptWrite_CELL_TRIMSEC, PM_CONCEPT_LEVEL_CELL); 452 psMetadataItem *cellBiassec = psMetadataItemAllocPtr("CELL.BIASSEC", PS_DATA_LIST, 453 "Bias sections", biassecs); 387 454 psFree(biassecs); 455 pmConceptRegister(cellBiassec, (pmConceptReadFunc)pmConceptRead_CELL_BIASSEC, 456 (pmConceptWriteFunc)pmConceptWrite_CELL_BIASSEC, PM_CONCEPT_LEVEL_CELL); 457 psFree(cellBiassec); 388 458 } 389 459 390 460 // CELL.XBIN 391 pmConceptRegister(psMetadataItemAllocS32("CELL.XBIN", "Binning in x", 0), 392 (pmConceptReadFunc)pmConceptRead_CELL_XBIN, 393 (pmConceptWriteFunc)pmConceptWrite_CELL_XBIN, PM_CONCEPT_LEVEL_CELL); 461 { 462 psMetadataItem *cellXbin = psMetadataItemAllocS32("CELL.XBIN", "Binning in x", 0); 463 pmConceptRegister(cellXbin, (pmConceptReadFunc)pmConceptRead_CELL_XBIN, 464 (pmConceptWriteFunc)pmConceptWrite_CELL_XBIN, PM_CONCEPT_LEVEL_CELL); 465 psFree(cellXbin); 466 } 394 467 395 468 // CELL.YBIN 396 pmConceptRegister(psMetadataItemAllocS32("CELL.YBIN", "Binning in y", 0), 397 (pmConceptReadFunc)pmConceptRead_CELL_YBIN, 398 (pmConceptWriteFunc)pmConceptWrite_CELL_YBIN, PM_CONCEPT_LEVEL_CELL); 469 { 470 psMetadataItem *cellYbin = psMetadataItemAllocS32("CELL.YBIN", "Binning in y", 0); 471 pmConceptRegister(cellYbin, (pmConceptReadFunc)pmConceptRead_CELL_YBIN, 472 (pmConceptWriteFunc)pmConceptWrite_CELL_YBIN, PM_CONCEPT_LEVEL_CELL); 473 psFree(cellYbin); 474 } 399 475 400 476 // CELL.TIMESYS 401 pmConceptRegister(psMetadataItemAllocS32("CELL.TIMESYS", "Time system", -1), 402 (pmConceptReadFunc)pmConceptRead_CELL_TIMESYS, 403 (pmConceptWriteFunc)pmConceptWrite_CELL_TIMESYS, PM_CONCEPT_LEVEL_CELL); 477 { 478 psMetadataItem *cellTimesys = psMetadataItemAllocS32("CELL.TIMESYS", "Time system", -1); 479 pmConceptRegister(cellTimesys, (pmConceptReadFunc)pmConceptRead_CELL_TIMESYS, 480 (pmConceptWriteFunc)pmConceptWrite_CELL_TIMESYS, PM_CONCEPT_LEVEL_CELL); 481 psFree(cellTimesys); 482 } 404 483 405 484 // CELL.TIME … … 409 488 time->sec = 0; 410 489 time->nsec = 0; 411 pmConceptRegister(psMetadataItemAlloc("CELL.TIME", PS_DATA_TIME, "Time of exposure", time), 412 (pmConceptReadFunc)pmConceptRead_CELL_TIME, 490 psMetadataItem *cellTime = psMetadataItemAlloc("CELL.TIME", PS_DATA_TIME, 491 "Time of exposure", time); 492 psFree(time); 493 pmConceptRegister(cellTime, (pmConceptReadFunc)pmConceptRead_CELL_TIME, 413 494 (pmConceptWriteFunc)pmConceptWrite_CELL_TIME, PM_CONCEPT_LEVEL_CELL); 414 psFree( time);495 psFree(cellTime); 415 496 } 416 497 417 498 // CELL.X0 418 pmConceptRegister(psMetadataItemAllocS32("CELL.X0", "Position of (0,0) on the chip", 0), 419 (pmConceptReadFunc)pmConceptRead_CELL_X0, 420 (pmConceptWriteFunc)pmConceptWrite_CELL_X0, PM_CONCEPT_LEVEL_CELL); 499 { 500 psMetadataItem *cellX0 = psMetadataItemAllocS32("CELL.X0", "Position of (0,0) on the chip", 0); 501 pmConceptRegister(cellX0, (pmConceptReadFunc)pmConceptRead_CELL_X0, 502 (pmConceptWriteFunc)pmConceptWrite_CELL_X0, PM_CONCEPT_LEVEL_CELL); 503 psFree(cellX0); 504 } 421 505 422 506 // CELL.Y0 423 pmConceptRegister(psMetadataItemAllocS32("CELL.Y0", "Position of (0,0) on the chip", 0), 424 (pmConceptReadFunc)pmConceptRead_CELL_Y0, 425 (pmConceptWriteFunc)pmConceptWrite_CELL_Y0, PM_CONCEPT_LEVEL_CELL); 426 427 } 507 { 508 psMetadataItem *cellY0 = psMetadataItemAllocS32("CELL.Y0", "Position of (0,0) on the chip", 0); 509 pmConceptRegister(cellY0, (pmConceptReadFunc)pmConceptRead_CELL_Y0, 510 (pmConceptWriteFunc)pmConceptWrite_CELL_Y0, PM_CONCEPT_LEVEL_CELL); 511 psFree(cellY0); 512 } 513 514 } 515 516 conceptsInitialised = true; 428 517 429 518 return init; -
branches/eam_rel9_p0/psModules/src/astrom/pmFPA.c
r6267 r6342 12 12 * XXX: Should we implement non-linear cell->chip transforms? 13 13 * 14 * @version $Revision: 1.1.2. 6$ $Name: not supported by cvs2svn $15 * @date $Date: 2006-0 1-31 20:09:52$14 * @version $Revision: 1.1.2.7 $ $Name: not supported by cvs2svn $ 15 * @date $Date: 2006-02-07 21:18:31 $ 16 16 * 17 17 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 33 33 *****************************************************************************/ 34 34 #define PS_FREE_HIERARCHY 1 35 #define PARENT_LINKS 0 36 35 37 static void readoutFree(pmReadout *readout) 36 38 { 37 39 if (readout != NULL) { 38 #if 039 40 psTrace(__func__, 9, "Removing readout %lx from cell %lx...\n", (size_t) readout, (size_t) readout->parent); 40 41 if (readout->parent) { … … 42 43 for (int i = 0; i < readouts->n; i++) { 43 44 if (readouts->data[i] == readout) { 44 pmReadout *tmpReadout = readouts->data[i];45 // pmReadout *tmpReadout = readouts->data[i]; 45 46 readouts->data[i] = NULL; 47 #if PARENT_LINKS 48 46 49 psFree(tmpReadout); 50 #endif 51 47 52 break; 48 53 } 49 54 } 50 55 } 56 psTrace(__func__, 9, "Freeing readout %lx\n", (size_t) readout); 57 58 #if PARENT_LINKS 59 60 psFree(readout->parent); 51 61 #endif 52 psTrace(__func__, 9, "Freeing readout %lx\n", (size_t) readout);53 54 psFree(readout->parent);55 62 56 63 psFree(readout->image); … … 64 71 { 65 72 if (cell != NULL) { 66 #if 067 73 psTrace(__func__, 9, "Removing cell %lx from chip %lx...\n", (size_t)cell, (size_t)cell->parent); 68 74 if (cell->parent) { … … 70 76 for (int i = 0; i < cells->n; i++) { 71 77 if (cells->data[i] == cell) { 72 pmCell *tmpCell = cells->data[i];78 // pmCell *tmpCell = cells->data[i]; 73 79 cells->data[i] = NULL; 80 #if PARENT_LINKS 81 74 82 psFree(tmpCell); 83 #endif 84 75 85 break; 76 86 } 77 87 } 78 88 } 89 psTrace(__func__, 9, "Freeing cell %lx\n", (size_t)cell); 90 91 pmCellFreeReadouts(cell); 92 psFree(cell->readouts); 93 #if PARENT_LINKS 94 95 psFree(cell->parent); 79 96 #endif 80 psTrace(__func__, 9, "Freeing cell %lx\n", (size_t)cell);81 82 pmCellFreeReadouts(cell);83 psFree(cell->parent);84 97 85 98 psFree(cell->toChip); … … 96 109 { 97 110 if (chip != NULL) { 98 #if 099 111 psTrace(__func__, 9, "Removing chip %lx from fpa %lx...\n", (size_t)chip, (size_t)chip->parent); 100 112 if (chip->parent) { … … 102 114 for (int i = 0; i < chips->n; i++) { 103 115 if (chips->data[i] == chip) { 104 pmChip *tmpChip = chips->data[i];116 // pmChip *tmpChip = chips->data[i]; 105 117 chips->data[i] = NULL; 118 #if PARENT_LINKS 119 106 120 psFree(tmpChip); 121 #endif 122 107 123 break; 108 124 } 109 125 } 110 126 } 127 psTrace(__func__, 9, "Freeing chip %lx\n", (size_t)chip); 128 129 pmChipFreeCells(chip); 130 psFree(chip->cells); 131 #if PARENT_LINKS 132 133 psFree(chip->parent); 111 134 #endif 112 psTrace(__func__, 9, "Freeing chip %lx\n", (size_t)chip);113 114 pmChipFreeCells(chip);115 psFree(chip->parent);116 135 117 136 psFree(chip->toFPA); … … 134 153 psFree(fpa->analysis); 135 154 psFree(fpa->camera); 136 #if 1137 155 // 138 156 // Set the parent to NULL in all fpa->chips before psFree(fpa->chips) … … 148 166 } 149 167 } 150 #endif168 psFree(fpa->chips); 151 169 psFree(fpa->hdu); 152 170 psFree(fpa->phu); … … 167 185 psTrace(__func__, 9, "Will now free readout %lx...\n", (size_t)tmpReadout); 168 186 psFree(tmpReadout); // Drop the readout 187 #if PARENT_LINKS 188 169 189 psFree(cell); // Decrement reference counter on cell, since readout->parent isn't held any more 190 #endif 191 170 192 } 171 193 cell->readouts = psArrayRealloc(cell->readouts, 0); 194 cell->readouts->n = 0; 172 195 } 173 196 … … 186 209 pmCellFreeReadouts(tmpCell);// Drop all readouts the cell holds 187 210 psFree(tmpCell); // Drop the cell 211 #if PARENT_LINKS 212 188 213 psFree(chip); // Decrement reference counter on chip, since cell->parent isn't held any more 214 #endif 215 189 216 } 190 217 chip->cells = psArrayRealloc(chip->cells, 0); 218 chip->cells->n = 0; 191 219 } 192 220 … … 219 247 tmpReadout->bias = psListAlloc(NULL); 220 248 tmpReadout->analysis = psMetadataAlloc(); 249 #if PARENT_LINKS 250 221 251 tmpReadout->parent = psMemIncrRefCounter(cell); 252 #else 253 254 tmpReadout->parent = cell; 255 #endif 256 222 257 if (cell != NULL) { 223 258 cell->readouts = psArrayAdd(cell->readouts, 1, (psPtr) tmpReadout); … … 249 284 tmpCell->analysis = psMetadataAlloc(); 250 285 tmpCell->readouts = psArrayAlloc(0); 286 #if PARENT_LINKS 287 251 288 tmpCell->parent = psMemIncrRefCounter(chip); 289 #else 290 291 tmpCell->parent = chip; 292 #endif 293 252 294 if (chip != NULL) { 253 295 chip->cells = psArrayAdd(chip->cells, 1, (psPtr) tmpCell); … … 282 324 tmpChip->analysis = psMetadataAlloc(); 283 325 tmpChip->cells = psArrayAlloc(0); 326 #if PARENT_LINKS 327 284 328 tmpChip->parent = psMemIncrRefCounter(fpa); 329 #else 330 331 tmpChip->parent = fpa; 332 #endif 333 285 334 if (fpa != NULL) { 286 335 fpa->chips = psArrayAdd(fpa->chips, 1, (psPtr) tmpChip); -
branches/eam_rel9_p0/psModules/src/astrom/pmFPAConstruct.c
r6062 r6342 101 101 psMetadata *cellData = getCellData(camera, cellName); 102 102 pmCell *cell = pmCellAlloc(chip, cellData, cellName); // The cell 103 psFree(cell); 104 // psFree(cellData);103 psFree(cell); // Drop reference 104 // psFree(cellData); // Drop reference 105 105 } 106 106 psFree(cellNamesIter); 107 107 psFree(cellNames); 108 psFree(chip); // Drop reference 108 109 } 109 110 … … 141 142 psMetadata *cellData = getCellData(camera, cellType); 142 143 pmCell *cell = pmCellAlloc(chip, cellData, extName); // The cell 143 // psFree(cellData); 144 // psFree(cellData); // Drop reference 144 145 cell->hdu = p_pmHDUAlloc(extName); // Prepare cell to receive FITS data 145 146 146 psFree(c hip);147 psFree(c ell);147 psFree(cell); // Drop reference 148 psFree(chip); // Drop reference 148 149 } 149 150 psFree(contents); … … 172 173 psMetadata *cellData = getCellData(camera, cellName); 173 174 pmCell *cell = pmCellAlloc(chip, cellData, cellName); // The cell 174 psFree(cell); 175 // psFree(cellData); 175 psFree(cell); // Drop reference 176 // psFree(cellData); // Drop reference 176 177 } 177 178 psFree(cellNamesIter); 179 psFree(chip); // Drop reference 178 180 } 179 181 … … 255 257 } 256 258 psFree(chipName); 257 psFree(chip); 259 psFree(chip); // Drop reference 258 260 259 261 } else {
Note:
See TracChangeset
for help on using the changeset viewer.
