Index: trunk/psModules/src/objects/pmSource.c
===================================================================
--- trunk/psModules/src/objects/pmSource.c	(revision 34315)
+++ trunk/psModules/src/objects/pmSource.c	(revision 34318)
@@ -1498,15 +1498,18 @@
 
 // Function to estimate the memory consumed by a source.
-// Not yet complete but it counts the biggest stuff.
-// XXX: handle child images. For big ones the array of data pointers is significant
-#define IMAGE_BYTES(_im, _pix_size) (_im ? (sizeof(psImage) + (_im->numRows * _im->numCols * _pix_size)) : 0)
+#define IMAGE_BYTES(_im, _pix_size) (_im ? (sizeof(psImage) + (_im->numRows * sizeof(void*)) + (_im->numRows * _im->numCols * _pix_size * (_im->parent ? 0 : 1))) : 0)
+
 #define VECTOR_BYTES(_v, _elem_size) (_v ? (sizeof(psVector) + (_v->n * _elem_size)) : 0)
 
-// estimate the memory consumed by this source
+// estimate the memory consumed by this source. 
+// It doesn't count everything (a couple of psArrays), the big stuff is counted
 psU64 pmSourceMemoryUse (pmSource *source) {
     psU64 bytes = sizeof(pmSource) + sizeof(pmPeak) + sizeof(pmMoments);
 
+    bytes += IMAGE_BYTES(source->pixels, 4);
+    bytes += IMAGE_BYTES(source->variance, 4);
     bytes += IMAGE_BYTES(source->modelVar, 4);
     bytes += IMAGE_BYTES(source->maskObj, 2);
+    bytes += IMAGE_BYTES(source->maskView, 2);
     bytes += IMAGE_BYTES(source->modelFlux, 4);
     bytes += IMAGE_BYTES(source->psfImage, 4);
