Author: miguel
Date: 2007-12-06 20:46:14 -0500 (Thu, 06 Dec 2007)
New Revision: 90888

Modified:
   branches/mono-1-2-6/mcs/class/Mono.Data.Sqlite/Mono.Data.Sqlite_2.0/ChangeLog
   
branches/mono-1-2-6/mcs/class/Mono.Data.Sqlite/Mono.Data.Sqlite_2.0/SQLiteFunction.cs
Log:
Backport to 1.2.6

Modified: 
branches/mono-1-2-6/mcs/class/Mono.Data.Sqlite/Mono.Data.Sqlite_2.0/ChangeLog
===================================================================
--- 
branches/mono-1-2-6/mcs/class/Mono.Data.Sqlite/Mono.Data.Sqlite_2.0/ChangeLog   
    2007-12-07 01:43:30 UTC (rev 90887)
+++ 
branches/mono-1-2-6/mcs/class/Mono.Data.Sqlite/Mono.Data.Sqlite_2.0/ChangeLog   
    2007-12-07 01:46:14 UTC (rev 90888)
@@ -1,3 +1,8 @@
+2007-12-06  Marek Habersack  <[EMAIL PROTECTED]>
+
+       * SQLiteFunction.cs: scan only assemblies which reference Sqlite,
+       saves heap memory.
+
 2007-07-31  Ben Motmans  <[EMAIL PROTECTED]>
 
        * SR.Designer.cs: use the correct resource name

Modified: 
branches/mono-1-2-6/mcs/class/Mono.Data.Sqlite/Mono.Data.Sqlite_2.0/SQLiteFunction.cs
===================================================================
--- 
branches/mono-1-2-6/mcs/class/Mono.Data.Sqlite/Mono.Data.Sqlite_2.0/SQLiteFunction.cs
       2007-12-07 01:43:30 UTC (rev 90887)
+++ 
branches/mono-1-2-6/mcs/class/Mono.Data.Sqlite/Mono.Data.Sqlite_2.0/SQLiteFunction.cs
       2007-12-07 01:46:14 UTC (rev 90888)
@@ -445,12 +445,30 @@
       SqliteFunctionAttribute at;
       System.Reflection.Assembly[] arAssemblies = 
System.AppDomain.CurrentDomain.GetAssemblies();
       int w = arAssemblies.Length;
+      System.Reflection.AssemblyName sqlite = 
System.Reflection.Assembly.GetCallingAssembly().GetName();
 
       for (int n = 0; n < w; n++)
       {
         Type[] arTypes;
+        bool found = false;
+        System.Reflection.AssemblyName[] references;
         try
         {
+          // Inspect only assemblies that reference SQLite
+          references = arAssemblies[n].GetReferencedAssemblies();
+          int t = references.Length;
+          for (int z = 0; z < t; z++)
+          {
+            if (references[z].Name == sqlite.Name)
+            {
+              found = true;
+              break;
+            }
+          }
+          
+          if (found == false)
+            continue;
+
           arTypes = arAssemblies[n].GetTypes();
         }
         catch (System.Reflection.ReflectionTypeLoadException e)

_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches

Reply via email to