Index: trunk/ppMerge/src/ppMergeCombine.c
===================================================================
--- trunk/ppMerge/src/ppMergeCombine.c	(revision 8405)
+++ trunk/ppMerge/src/ppMergeCombine.c	(revision 8417)
@@ -9,6 +9,44 @@
 #include "ppMergeCombine.h"
 
+#if 0
+static psMemId memId = 0;
+
+static FILE *dumpFile = NULL;
+
+static psMemId mbAlloc(psMemBlock *mb)
+{
+    if (!dumpFile) {
+        dumpFile = fopen("memBlocks.dat", "w");
+    }
+    fprintf(dumpFile, "Alloc: %12lu\t%12zd\t%s:%d\n", mb->id, mb->userMemorySize,
+            mb->file, mb->lineno);
+    return 1;
+}
+
+static void dumpDone(void)
+{
+    fclose(dumpFile);
+    exit(EXIT_FAILURE);
+}
+
+
+static void memDump(void)
+{
+    psMemBlock **leaks = NULL;
+    int numLeaks = psMemCheckLeaks(memId, &leaks, NULL, true);
+    FILE *memFile = fopen("mem.dat", "w");
+    fprintf(memFile, "# MemBlock Size Source\n");
+    for (int i = 0; i < numLeaks; i++) {
+        psMemBlock *mb = leaks[i];
+        fprintf(memFile, "%12lu\t%12zd\t%s:%d\n", mb->id, mb->userMemorySize,
+                mb->file, mb->lineno);
+    }
+    fclose(memFile);
+    psFree(leaks);
+}
+
 static void memCheck(void)
 {
+    return;
     if (psTraceGetLevel(__func__) > 9) {
         psMemBlock **leaks = NULL;
@@ -32,5 +70,5 @@
     return;
 }
-
+#endif
 
 // Combine the inputs
@@ -42,5 +80,4 @@
     )
 {
-
     psArray *filenames = psMetadataLookupPtr(NULL, config->arguments, "INPUT"); // The input file names
     assert(filenames);                  // It should be here --- it's put here in ppMergeConfig
@@ -86,4 +123,7 @@
             }
 
+#if 1
+            // Read bit by bit
+
             int numRead;  // Number of inputs read
             int numScan = 0;
@@ -124,7 +164,41 @@
                 numScan++;
 
-                memCheck();
-
             } while (numRead > 0);
+
+#else
+            // Read whole cells at a time
+
+            printf("Chip %d, cell %d\n", i, j);
+            int numRead = 0;  // Number of inputs read
+            for (int k = 0; k < filenames->n; k++) {
+                if (! filenames->data[k] || strlen(filenames->data[k]) == 0) {
+                    continue;
+                }
+                psFits *fits = data->files->data[k]; // FITS file handle
+                if (!fits) {
+                    psError(PS_ERR_IO, false, "Unable to open input file %s --- ignored.\n",
+                            filenames->data[k]);
+                    continue;
+                }
+                pmFPA *fpaIn = data->in->data[k]; // Input FPA
+                pmChip *chipIn = fpaIn->chips->data[i]; // Input chip
+                pmCell *cellIn = chipIn->cells->data[j]; // Input cell
+                if (!cellIn->file_exists || !cellIn->data_exists) {
+                    continue;
+                }
+                if (!pmCellRead(cellIn, fits, config->database) || cellIn->readouts->n == 0) {
+                    continue;
+                }
+                stack->data[k] = cellIn->readouts->data[0];
+                numRead++;
+            }
+            if (numRead > 0) {
+                pmReadoutCombine(readout, stack, cellZeros, cellScales, options->combine);
+                psTrace(__func__, 5, "Chip %d, cell %d\n", i, j);
+            }
+
+            memCheck();
+#endif
+
             psFree(readout);            // Drop reference
             psFree(stack);
@@ -144,6 +218,4 @@
                 pmCellFreeData(cell);
             }
-
-            memCheck();
         }
 
@@ -161,6 +233,4 @@
             pmChipFreeData(chip);
         }
-
-        memCheck();
     }
 
@@ -178,6 +248,5 @@
     pmFPAFreeData(data->out);
 
-    memCheck();
-
     return true;
-}
+
+}
