Index: /trunk/psphot/src/Makefile.am
===================================================================
--- /trunk/psphot/src/Makefile.am	(revision 7637)
+++ /trunk/psphot/src/Makefile.am	(revision 7638)
@@ -42,4 +42,5 @@
 	psphotFitSet.c		\
 	psphotWeightBias.c	\
+	psphotSourceFreePixels.c \
 	psphotCleanup.c	   	
 
Index: /trunk/psphot/src/psphot.h
===================================================================
--- /trunk/psphot/src/psphot.h	(revision 7637)
+++ /trunk/psphot/src/psphot.h	(revision 7638)
@@ -45,5 +45,5 @@
 void            psphotTestArguments (int *argc, char **argv);
 bool            psphotMaskReadout (pmReadout *readout, psMetadata *recipe);
-// bool            psphotBackgroundNames (psMetadata *arguments);
+void            psphotSourceFreePixels (psArray *sources);
 
 // functions to set the correct source pixels
Index: /trunk/psphot/src/psphotReadout.c
===================================================================
--- /trunk/psphot/src/psphotReadout.c	(revision 7637)
+++ /trunk/psphot/src/psphotReadout.c	(revision 7638)
@@ -86,4 +86,7 @@
     psphotSkyReplace (config, view);
 
+    // drop the references to the image pixels held by each source
+    psphotSourceFreePixels (sources);
+
     // save the results of the analysis 
     psMetadataAdd (readout->analysis, PS_LIST_TAIL, "PSPHOT.SOURCES", PS_DATA_ARRAY,    "psphot sources", sources);
Index: /trunk/psphot/src/psphotSourceFreePixels.c
===================================================================
--- /trunk/psphot/src/psphotSourceFreePixels.c	(revision 7638)
+++ /trunk/psphot/src/psphotSourceFreePixels.c	(revision 7638)
@@ -0,0 +1,12 @@
+# include "psphot.h"
+
+void psphotSourceFreePixels (psArray *sources) {
+
+    if (!sources) return;
+
+    for (int i = 0; i < sources->n; i++) {
+	pmSource *source = sources->data[i];
+	pmSourceFreePixels (source);
+    }
+    return;
+}
