IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Oct 8, 2007, 8:52:49 AM (19 years ago)
Author:
eugene
Message:

example code illustrating memory problem

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/psModules/src/objects/pmSourceIO_PS1_DEV_1.c

    r15080 r15243  
    33 *  @author EAM, IfA
    44 *
    5  *  @version $Revision: 1.2 $ $Name: not supported by cvs2svn $
    6  *  @date $Date: 2007-09-28 21:04:55 $
     5 *  @version $Revision: 1.3 $ $Name: not supported by cvs2svn $
     6 *  @date $Date: 2007-10-08 18:52:49 $
    77 *
    88 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    164164        modelType = pmModelClassGetType (PSF_NAME);
    165165    }
     166    assert (modelType > -1);
    166167
    167168    psArray *table = psFitsReadTable (fits);
    168169    // validate a single row of the table (must match SMP)
     170
     171    // XXX test return values
     172
     173    // XXX we have a memory problem, which is illustrated here: if I allocate the sources array
     174    // (line 1) before freeing the table, the data is not really freed (but not a leak?)  if I
     175    // allocate the sources array *after* freeing the table, the data is actually freed
     176    // psArray *fooSources = psArrayAllocEmpty (10000);
     177    // psFree (table);
     178    // return (fooSources);
    169179
    170180    psArray *sources = psArrayAlloc (table->n);
Note: See TracChangeset for help on using the changeset viewer.