Index: /branches/eam_branches/ipp-20110505/Ohana/src/libdvo/src/dvo_catalog_split.c
===================================================================
--- /branches/eam_branches/ipp-20110505/Ohana/src/libdvo/src/dvo_catalog_split.c	(revision 31585)
+++ /branches/eam_branches/ipp-20110505/Ohana/src/libdvo/src/dvo_catalog_split.c	(revision 31586)
@@ -172,4 +172,5 @@
   header.buffer = NULL;
   primary = NULL;
+  status = FALSE;
 
   /* get the components from the header - these duplicate information in the split files (NAXIS2) */
Index: /branches/eam_branches/ipp-20110505/Ohana/src/relphot/src/load_images.c
===================================================================
--- /branches/eam_branches/ipp-20110505/Ohana/src/relphot/src/load_images.c	(revision 31585)
+++ /branches/eam_branches/ipp-20110505/Ohana/src/relphot/src/load_images.c	(revision 31586)
@@ -65,5 +65,5 @@
       }
       Nsubset += NsubsetExtra;
-      MARKTIME("selected %d overlapping images: %f sec\n", (int) Nsubset, dtime);
+      MARKTIME("selected %d overlapping images: %f sec\n", (int) NsubsetExtra, dtime);
     } else {
       skylist = SkyListByPatch (sky, -1, region);
@@ -72,5 +72,5 @@
       // 'subset' points to a new copy of the data (different from 'image')
       subset = select_images (skylist, image, Nimage, &LineNumber, &Nsubset);
-      MARKTIME("selected %d overlapping images: %f sec\n", (int) NsubsetExtra, dtime);
+      MARKTIME("selected %d overlapping images: %f sec\n", (int) Nsubset, dtime);
     }
   } else {
Index: /branches/eam_branches/ipp-20110505/Ohana/src/relphot/src/relphot.c
===================================================================
--- /branches/eam_branches/ipp-20110505/Ohana/src/relphot/src/relphot.c	(revision 31585)
+++ /branches/eam_branches/ipp-20110505/Ohana/src/relphot/src/relphot.c	(revision 31586)
@@ -1,4 +1,10 @@
 # include "relphot.h"
 # define USE_DIRECT 0
+
+# define TIMESTAMP(TIME) \
+    gettimeofday (&stop, (void *) NULL);	\
+    dtime = DTIME (stop, start);		\
+    TIME += dtime;				\
+    gettimeofday (&start, (void *) NULL);
 
 # define MARKTIME(MSG,...) { \
@@ -17,4 +23,82 @@
 
   gettimeofday (&start, (void *) NULL);
+
+  // XXX quick and stupid test:
+  if (0) {
+    int i, j; 
+    off_t *Nlist, *NLIST, **mlist;
+    off_t *NlistI, *NLISTI, **mlistI;
+    int **clist;
+    int **clistI;
+    float dtime;
+    float time1 = 0.0;
+    float time2 = 0.0;
+
+    int Nmosaic = 10000;
+    int Nimage = 600000;
+
+    for (j = 0; j < 19000; j++) {
+
+      // mosaic indexes
+      ALLOCATE (Nlist, off_t,   Nmosaic);
+      ALLOCATE (NLIST, off_t,   Nmosaic);
+      ALLOCATE (clist, int *,   Nmosaic);
+      ALLOCATE (mlist, off_t *, Nmosaic);
+    
+      for (i = 0; i < Nmosaic; i++) {
+	Nlist[i] = 0;
+	NLIST[i] = 100;
+	ALLOCATE (clist[i], int,   NLIST[i]);
+	ALLOCATE (mlist[i], off_t, NLIST[i]);
+      }
+
+      // image indexes
+      ALLOCATE (NlistI, off_t,   Nimage);
+      ALLOCATE (NLISTI, off_t,   Nimage);
+      ALLOCATE (clistI, int *,   Nimage);
+      ALLOCATE (mlistI, off_t *, Nimage);
+    
+      for (i = 0; i < Nimage; i++) {
+	NlistI[i] = 0;
+	NLISTI[i] = 100;
+	ALLOCATE (clistI[i], int,   NLISTI[i]);
+	ALLOCATE (mlistI[i], off_t, NLISTI[i]);
+      }
+
+      TIMESTAMP(time1);
+
+      // free mosaic indexes
+      for (i = 0; i < Nmosaic; i++) {
+	free (clist[i]);
+	free (mlist[i]);
+      }
+      free (Nlist);
+      free (NLIST);
+      free (clist);
+      free (mlist);
+
+      // free image indexes
+      for (i = 0; i < Nimage; i++) {
+	free (clistI[i]);
+	free (mlistI[i]);
+      }
+      free (NlistI);
+      free (NLISTI);
+      free (clistI);
+      free (mlistI);
+
+      TIMESTAMP(time2);
+
+      if (j % 100 == 0) {
+	fprintf (stderr, "done with %d\n", j);
+	fprintf (stderr, "time1  %f : init mosaic\n", time1);
+	fprintf (stderr, "time2  %f : free mosaic\n", time2);
+      }
+    }
+    
+    fprintf (stderr, "time1  %f : init mosaic\n", time1);
+    fprintf (stderr, "time2  %f : free mosaic\n", time2);
+    exit (1);
+  }
 
   /* get configuration info, args */
