IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 6148


Ignore:
Timestamp:
Jan 21, 2006, 5:29:19 PM (20 years ago)
Author:
Paul Price
Message:

It's working, but with memory leaks; tried to fix them, but they are buried a long way down.

Location:
trunk/ppImage/src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/ppImage/src/ppImage.c

    r6114 r6148  
    11#include "ppImage.h"
     2
     3psMemId ppMemAlloc(const psMemBlock *ptr)
     4{
     5    psLogMsg(__func__, PS_LOG_INFO,
     6             "Allocated memory block %d: %ld references\n"
     7             "\tFile %s, line %d, size %d\n"
     8             "\tPosts: %lx %lx %lx\n"
     9             "\tLast operation: %s:%d\n",
     10             ptr->id, ptr->refCounter, ptr->file, ptr->lineno, ptr->userMemorySize, ptr->startblock,
     11             ptr->endblock, *(void**)((int8_t *)(ptr + 1) + ptr->userMemorySize),
     12             ptr->lastopFile, ptr->lastopLine);
     13    return 0;
     14}
     15
     16psMemId ppMemFree(const psMemBlock *ptr)
     17{
     18    psLogMsg(__func__, PS_LOG_INFO,
     19             "Freed memory block %d: %ld references\n"
     20             "\tFile %s, line %d, size %d\n"
     21             "\tPosts: %lx %lx %lx\n"
     22             "\tLast operation: %s:%d\n",
     23             ptr->id, ptr->refCounter-1, ptr->file, ptr->lineno, ptr->userMemorySize, ptr->startblock,
     24             ptr->endblock, *(void**)((int8_t *)(ptr + 1) + ptr->userMemorySize),
     25             ptr->lastopFile, ptr->lastopLine);
     26    return 0;
     27}
     28
    229
    330int main(int argc, char **argv)
    431{
     32#if 0
     33    psMemAllocCallbackSet(ppMemAlloc);
     34    psMemFreeCallbackSet(ppMemFree);
     35//    psMemAllocCallbackSetID(6967);
     36//    psMemFreeCallbackSetID(6967);
     37    psMemAllocCallbackSetID(51804);
     38    psMemFreeCallbackSetID(51804);
     39#endif
    540
    641    ppData data;
  • trunk/ppImage/src/ppImageLoop.c

    r6125 r6148  
    11# include "ppImage.h"
     2
     3#define MEM_LEAKS 1
    24
    35psMemId ppMemPrint(const psMemBlock *ptr)
     
    6365    for (int i = 0; i < chips->n; i++) {
    6466
    65         if (i > 6) {
    66             continue;
    67         }
    68 
    6967        if (processChip >= 0 && i != processChip) {
    7068            continue;
     
    8482        pmChip *maskChip  = data->mask->fpa->chips->data[i];
    8583        pmChip *flatChip  = data->flat->fpa->chips->data[i];
     84
     85        ppMemPrint((psMemBlock*)inputChip-1);
    8686
    8787        psArray *cells = inputChip->cells;
     
    107107
    108108            // Need to free detrend cells here so we have enough memory to do other stuff
     109#ifndef MEM_LEAKS
    109110            psFree(detrend.bias);
    110111            psFree(detrend.dark);
    111112            psFree(detrend.mask);
    112113            psFree(detrend.flat);
     114#endif
    113115        }
    114116
     
    118120        // XXX EAM: Photometry goes here!
    119121
    120         // A kludge to get the write to behave wrt the concepts
     122        // A kludge to get the write to behave wrt the concepts --- we've changed the camera format, so
     123        // the concepts don't know what on earth to do.
    121124        const psMetadata *camera = data->input->fpa->camera;
    122125        data->input->fpa->camera = NULL;
     
    125128
    126129        // Now I can blow away the mosaic so I can then read more.
    127         psFree(chips->data[i]);
     130#ifndef MEM_LEAKS
     131        pmChipFreeCells(inputChip);
    128132        ppMemPrint((psMemBlock*)chips->data[i]-1);
     133#endif
    129134    }
    130135
     
    152157
    153158    // Free the detrend FPA and chips
     159#ifndef MEM_LEAKS
    154160    psFree(data->bias);
    155161    psFree(data->dark);
    156162    psFree(data->mask);
    157163    psFree(data->flat);
     164#endif
    158165
    159166    psFitsClose(data->output);
Note: See TracChangeset for help on using the changeset viewer.