[cig-commits] r7072 - in long/3D/Gale/trunk: . src/StGermain/Base/Context/src

walter at geodynamics.org walter at geodynamics.org
Tue Jun 5 12:29:13 PDT 2007


Author: walter
Date: 2007-06-05 12:29:13 -0700 (Tue, 05 Jun 2007)
New Revision: 7072

Modified:
   long/3D/Gale/trunk/
   long/3D/Gale/trunk/src/StGermain/Base/Context/src/DictionaryCheck.c
Log:
 r1810 at earth:  boo | 2007-06-05 12:26:05 -0700
 Make a limit of 1000 maximum errors from duplicate entries.  Otherwise, you can use too much memory for large input files



Property changes on: long/3D/Gale/trunk
___________________________________________________________________
Name: svk:merge
   - 3a629746-de10-0410-b17b-fd6ecaaa963e:/cig:1808
   + 3a629746-de10-0410-b17b-fd6ecaaa963e:/cig:1810

Modified: long/3D/Gale/trunk/src/StGermain/Base/Context/src/DictionaryCheck.c
===================================================================
--- long/3D/Gale/trunk/src/StGermain/Base/Context/src/DictionaryCheck.c	2007-06-05 18:34:29 UTC (rev 7071)
+++ long/3D/Gale/trunk/src/StGermain/Base/Context/src/DictionaryCheck.c	2007-06-05 19:29:13 UTC (rev 7072)
@@ -56,10 +56,12 @@
 	Stream* errStream = Journal_Register( Error_Type, "DictionaryCheck");
 	int errCount;
 	int** keyIndexArray;
+        int max_errors;
 
+        max_errors=1000;
 
-	keyIndexArray = Memory_Alloc_2DArray( int, ((dictionary->count)*(dictionary->count - 1)), 
-					2, "Key Index Array" );
+	keyIndexArray = Memory_Alloc_2DArray( int, max_errors,
+                                              2, "Key Index Array" );
 	/* Iterate through the whole dictionary*/
 	errCount = 0;
 	for ( index_I = 0; index_I < dictionary->count; ++index_I )
@@ -79,7 +81,12 @@
 					keyIndexArray[errCount][1] = index_J;					
 /* 					increment counter */
 					errCount++;
-					
+                                        /* If too many errors, stop counting */
+                                        if(errCount>=max_errors)
+                                          {
+                                            index_I=dictionary->count;
+                                            index_J=dictionary->count;
+                                          }
 				}
 			}
 			



More information about the cig-commits mailing list