Author: mhabersack
Date: 2007-12-06 14:22:52 -0500 (Thu, 06 Dec 2007)
New Revision: 90845

Modified:
   trunk/mcs/class/Mono.Data.Sqlite/Mono.Data.Sqlite_2.0/ChangeLog
   trunk/mcs/class/Mono.Data.Sqlite/Mono.Data.Sqlite_2.0/SQLiteFunction.cs
Log:
2007-12-06  Marek Habersack  <[EMAIL PROTECTED]>

        * SQLiteFunction.cs: scan only assemblies which reference Sqlite,
        saves heap memory.


Modified: trunk/mcs/class/Mono.Data.Sqlite/Mono.Data.Sqlite_2.0/ChangeLog
===================================================================
--- trunk/mcs/class/Mono.Data.Sqlite/Mono.Data.Sqlite_2.0/ChangeLog     
2007-12-06 18:50:57 UTC (rev 90844)
+++ trunk/mcs/class/Mono.Data.Sqlite/Mono.Data.Sqlite_2.0/ChangeLog     
2007-12-06 19:22:52 UTC (rev 90845)
@@ -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
@@ -7,7 +12,7 @@
        * SQLiteConvert.cs: Port function for converting native UTF8 string
       into managed string from the old SqliteClient implementation.
       Use it instead of PtrToStrAuto, which fails on Windows.
-
+
 2007-02-20  Marek Habersack  <[EMAIL PROTECTED]>
 
        * SQLite3.cs: handle sqlite3_prepare_v2 absent from the library,

Modified: 
trunk/mcs/class/Mono.Data.Sqlite/Mono.Data.Sqlite_2.0/SQLiteFunction.cs
===================================================================
--- trunk/mcs/class/Mono.Data.Sqlite/Mono.Data.Sqlite_2.0/SQLiteFunction.cs     
2007-12-06 18:50:57 UTC (rev 90844)
+++ trunk/mcs/class/Mono.Data.Sqlite/Mono.Data.Sqlite_2.0/SQLiteFunction.cs     
2007-12-06 19:22:52 UTC (rev 90845)
@@ -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